akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int t = in.nextInt();
            int ans = x - t;
            out.println(t < x ? ans : 0);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
import math
a,b,h,m = map(int,input().split())

p = 6*m
j = 30*h + m/60*30

if p >= j:
    if p - j < 180:
        w = p-j
    else:
        w = 360 - p + j
else:
    if j-p <180:
        w = j-p
    else:
        w = 360 - j + p



c = math.cos(math.radians(w))

C = math.sqrt(a**2 + b**2 - 2*a*b*c)

print(C)

Measured memory_bytes: 9452
from math import ceil

D, G = [int(t) for t in input().split()]
p = []
c = []
for i in range(D):
    p_, c_ = [int(t) for t in input().split()]
    p.append(p_)
    c.append(c_)

def solve(G, i):
    """100i点以下の問題だけでGを達成する最小問題数"""
    if i <= 0:
        return float('inf')
    #最も配転が高い問題で総合点を超えることができるか確認
    n = min(ceil(G / (100 * i)), p[i - 1])
    s = 100 * i * n
    #もし総合展を超えることができるときの問題数がボーナス点に達するならば足す
    if n == p[i - 1]:
        s += c[i - 1]
    if G > s:
        n += solve(G - s, i - 1)
    return min(n, solve(G, i - 1))

print(solve(G, D))

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

using namespace std;

int main(){

  int s;
  scanf("%d", &s);

  vector<int> v;

  bool flag = false;
  int i = 1;
  int na;
  while(!flag){
    if(s%2==0){
      na = s/2;
    }else{
      na = s*3+1;
    }
    auto itr = std::find(v.begin(), v.end(), na);
    if(itr != v.end())
      flag = true;
    v.push_back(s);
    s = na;
    i++;
  }

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

}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    val sd = sc.next().toList().sorted().joinToString(separator = "")
    val td = sc.next().toList().sorted().reversed().joinToString(separator = "")

    val res = if (sd < td) "Yes" else "No"

    println(res)
}

Measured memory_bytes: 35788
#include <iostream>

#define REP(i,n) for(int i=0; i<n; i++)
#define MAXN 200005

using namespace std;

int s, t;

long long int tempdiff(long long int a){
	if (a>=0) return -s*a;
	else return t*(-a);
}

int main(){
	long long int n, q, a[MAXN], temp[MAXN], l, r, x, ans;
	
	cin >> n >> q >> s >> t;
	REP(i,n+1) cin >> a[i];
	for (int i=n; i>0; i--) a[i] = a[i]-a[i-1];
	
	temp[0] = 0;
	for (int i=1; i<n+1; i++){
		temp[i] = tempdiff(a[i]);
	}
	
	ans = 0;
	REP(i,n+1) ans += temp[i];
	//printf("ans = %d\n", ans);
	
	REP(j,q){
		cin >> l >> r >> x;
		a[l] += x;
		ans += tempdiff(a[l]) - temp[l];
		temp[l] = tempdiff(a[l]);
		if (r<n){
			a[r+1] += -x;
			ans += tempdiff(a[r+1]) - temp[r+1];
			temp[r+1] = tempdiff(a[r+1]);
		}
		cout << ans << endl;
	}
		
	return 0;
}



Measured memory_bytes: 6236
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
int main(){
    int x;
    cin >> x;
    int count500=0,count5=0;
    while(x>=500){
        x-=500;
        count500++;
    }
    while(x>=5){
        x-=5;
        count5++;
    }
    cout << count500*1000+count5*5 << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>

using namespace std;

int main() {
    int K, K1, K2;
    cin >> K;
    K1 = K / 2;
    K2 = K1 + 1;
    if (K % 2 == 0) {
        cout << K1 * K1 << endl;
    } else {
        cout << K1 * K2 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
int main(){
  int n;
  scanf("%d",&n);
  int ans=0;
  for(int i=0;i<n;i++){
    int l,r;
    scanf("%d %d",&l,&r);
    ans+=r-l+1;
  }
  printf("%d\n",ans);
  return 0;
}


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

signed main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int x = c - a;
    int y = d - b;

    for(int i = 0;i < y;i ++){
        cout << 'U';
    }
    for(int i = 0;i < x;i ++){
        cout << 'R';
    }
    for(int i = 0;i < y;i ++){
        cout << 'D';
    }
    for(int i = 0;i < x;i ++){
        cout << 'L';
    }
    cout << 'L';
    for(int i = 0;i < y+1;i ++){
        cout << 'U';
    }
    for(int i = 0;i < x+1;i ++){
        cout << 'R';
    }
    cout << 'D';
    cout << 'R';
    for(int i = 0;i < y+1;i ++){
        cout << 'D';
    }
    for(int i = 0;i < x+1;i ++){
        cout << 'L';
    }
    cout << 'U' << endl;;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static double tri(double x1, double y1, double x2, double y2, double x3, double y3) {
		double vx1 = x2-x1;
		double vy1 = y2-y1;
		double vx2 = x3-x1;
		double vy2 = y3-y1;
		
		return vx1*vy2 - vx2* vy1;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			double[][] p = new double[3][2];
			for(int i=0; i<3; i++) {
				p[i][0] = sc.nextDouble();
				p[i][1] = sc.nextDouble();
			}
			double px = sc.nextDouble();
			double py = sc.nextDouble();
			
			boolean f = true;
			boolean g = true;
			
			for(int i=0; i<3; i++) {
				double tri = tri(p[i][0], p[i][1], p[(i+1)%3][0], p[(i+1)%3][1], px, py);
				if(tri >= 0) f = false;
				if(tri <= 0) g = false;
			}
			System.out.println(f||g?"YES":"NO");
		}
	}
}



Measured memory_bytes: 32428
//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#define repe(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define mst(a, b)   memset((a), (b), sizeof(a))
#define gc() gutchar()
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pr;
typedef long long ll;
const double eps = 1e-5;
const int inf = 0x3f3f3f3f;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const ll mod = 1e9+7;
const int N = 2e5+5;

int p[N];
double res, sum;

int main()
{
	int n, k;
	cin >> n >> k;
	rep(i, 0, n){
		scanf("%d", &p[i]);
	}
	int l, r;
	l = r = 0;
	while (l < n)
	{
		while (r < n && r-l < k)
		{
			sum += 0.5 * (p[r] + 1);
			r++;
		}
		if (r - l < k)	break;
		res = max(res, sum);
		sum -= 0.5 * (p[l] + 1); l++;
	}
	printf("%.12f\n", res);
	return 0;
}

Measured memory_bytes: 1024
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define deb(x) cout<<#x<<" "<<x<<el;
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

template<typename T>
void read(T& a)
{
  cin>>a;
}
template<typename T, typename... Args>
void read(T& a,Args&... args)
{
  cin>>a; read(args...);
}

template<typename T>
void write(T a)
{
  cout<<a<<' ';
}
template<typename T, typename... Args>
void write(T a,Args... args)
{
  cout<<a<<' '; write(args...);
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=((ans*((n-i)%N))%N*modInverse(i+1,N))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    cin>>n;
    vi v[n-1];
    forup(i,n-1)
    {
      cin>>m;
      v[m-1].pb(i+1);
    }
    int ans[n]={0};
    ans[n-1]=0;
    for(int i=n-2;i>=0;i--)
    {
      ans[i]=v[i].size();
    }
    forup(i,n) write(ans[i]);

  }


  return 0;
}


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

#define WHITE 0
#define GRAY 1
#define BLACK 2

char a[100][100]; //隣接行列
int n;            //行列のサイズ
short d[100];     //頂点1からの距離
char color[100];  //探索状況
short q[100];     //キュー
short h, t;       //キューの先頭と末尾


void init() {
 short i;

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

 return;
}

void enqueue( short e ) {

 if( (t+1) % 100 != h ) {
   q[t] = e;
   t = (t + 1) % 100;
 }

 return;
}

short dequeue() {
  short r = -1;

 if( h != t ) {
   r = q[h];
   h = (h + 1) % 100;
 }

 return r;
}


void bfs() {
 short i, u;

 //探査状況と最短距離を初期化
 for( i=1; i<n; i++) {
   color[u] = WHITE;
   d[u] = -1;
 }

 color[0] = GRAY;
 d[0] = 0;

 enqueue( 0 );

 while( ( u = dequeue() ) != -1 ) { //キューが空でない
   for( i=0; i<n; i++ ) {

       if( a[u][i] == 1 && color[ i ] == WHITE ) {
	 color[ i ] = GRAY;
	 d[i] = d[u] + 1;
	 enqueue( i );
       }

   }
   color[u] = BLACK;
 }
 
 return;
}


void printDist() {
  short i;
  
  for( i=0; i<n; i++ ) {
    printf( "%d %d\n", i+1, d[i] );
  }
  return;
}


int main() {
  
  short i, j;
  int u, k, v;
  
  scanf( "%d", &n );
  
  init();
  
  
  for( i=0; i<n; i++ ) {
    scanf( "%d%d", &u, &k );
    
    for( j=0; j<k; j++ ) {
      scanf( "%d", &v );
      a[u-1][v-1] = 1;
    }
    
  }
  
  bfs();
  
  printDist();
  
  return 0;
  
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int f=0,s=0,p;
    REP(i,3){
        cin>>p;
        if(p==5)f++;
        if(p==7)s++;
    }
    cout<<(f==2&&s==1?"YES":"NO")<<endl;
}

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

using namespace std;

using int64 = long long;
const int mod = 1000003;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N, K;
  cin >> N >> K;
  vector< double > P(N);
  cin >> P;
  vector< double > S(N + 1);
  for(int i = 0; i < N; i++) S[i + 1] = S[i] + (P[i] + 1) / 2;
  double ret = 0;
  for(int i = K; i <= N; i++) {
    chmax(ret, 1.0 * (S[i] - S[i - K]));
  }
  cout << ret << endl;
}


Measured memory_bytes: 3456
n,m,l = gets.split.map {|s| s.to_i}
a = Array.new
b = Array.new
for i in 1..n
  c = gets.split.map {|s| s.to_i}
  a.push(c)
end
for j in 1..m
  c = gets.split.map {|s| s.to_i}
  b.push(c)
end
for i in 1..n
  for j in 1..l
    print " " unless j == 1
    s = 0
    for k in 1..m
      s += a[i-1][k-1] * b[k-1][j-1]
    end
    print s
  end
  print "\n"
end


Measured memory_bytes: 7128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,x,y,z,l,n,m,a,r,f;
  long long min,max,sum;
  //vector<vector<int>> A(n, vector<int>(m, 0));
  vector<int> B(26, 0);
  string s,g;
  string s1;
  
  getline(cin,s);
  for(int i=0;i<s.size();++i) s1+=tolower(s[i]);
  sum = 0;
  while(1){
  	cin >> g;
    if(g == "END_OF_TEXT")break;
    string g1;
    for(int i=0;i<g.size();++i) g1+=tolower(g[i]);
    
    if(s1==g1)++sum;
  }
  cout << sum << endl;
}


Measured memory_bytes: 3212
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, 0, n)

const int inf = 999999999;
const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	cin.tie(0);
	string Sd, T;
	cin >> Sd >> T;

	bool ans = false;
	int ix_start = 0;
	REP(i, Sd.size() - T.size() + 1) {
		string subs = Sd.substr(i, T.size());
		REP(j, T.size()) {
			if (Sd[i + j] != '?' && Sd[i + j] != T[j]) break;
			if (j == T.size() - 1) {
				ix_start = i;
				ans = true;
			}
		}
	}

	if (ans) {
		string S = Sd;
		REP(i, S.size()) {
			if (i == ix_start) {
				REP(j, T.size()) {
					S[i + j] = T[j];
				}
				i += T.size() - 1;
				continue;
			}
			if (S[i] == '?') {
				S[i] = 'a';
			}
		}
		cout << S;
	}
	else {
		cout << "UNRESTORABLE";
	}
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define ll                          long long
#define in(a)                       ll a; cin>>a;
#define in2(a,b)                    ll a,b; cin>>a>>b;
#define in3(a,b,c)                  ll a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                ll a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              ll a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define pb                          push_back
#define bhar(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"                       
#define ce(x)                       cout<<x<<"\n";
#define nl                          cout<<endl;
#define jaldi                       ios_base::sync_with_stdio(false);cin.tie(NULL);
#define dekh_lo                     ce("dekh_lo");
#define sz(x)                       (ll)x.size()
#define re                          return

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;

const ll mod=1e9+7;
const ll N=4e5+5;
ll i,j;

/*


*/
ll dp[3005][3005][2];
ll solve(vector<ll>& a,ll l,ll r,ll turn){
	if(l>r){
		re 0;
	}
	if(dp[l][r][turn]!=-1){
		re dp[l][r][turn];
	}
	if(turn==1){
		re dp[l][r][turn]=max(a[l]+solve(a,l+1,r,0),a[r]+solve(a,l,r-1,0)); 
	}
	else{
		re dp[l][r][turn]=min(solve(a,l+1,r,1),solve(a,l,r-1,1));
	}
}
void solve(){
	bhar(dp,-1);
    in(n);
    vi a(n); lelo(a);
    ll sum=accumulate(call(a),(ll)0);
    ll x=solve(a,0,n-1,1);
    debug(x,sum);
    ll y=sum-x;
    ce(x-y);
}

int32_t main(){
    jaldi
    ll t; 
    // cin>>t;
    t=1;     
    while(t--){
        solve();
    }
}

/*


*/

  

Measured memory_bytes: 144980
kuri_now = False
cost = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]
kuri = [0, 0, 0, 0, 0, 0.5, 1, 1, 1, 1, 1]
result = 0
for digit in reversed(input()):
    digit = int(digit)
    if kuri_now == 0:
        result += cost[digit]
        kuri_now = kuri[digit]
    elif kuri_now == 1:
        result += cost[digit + 1]
        kuri_now = kuri[digit + 1]
    else:
        if cost[digit] <= cost[digit + 1]:
            result += cost[digit]
            kuri_now = kuri[digit]
        else:
            result += cost[digit + 1]
            kuri_now = kuri[digit + 1]
if kuri_now == 1:
    result += 1
print(result)

Measured memory_bytes: 53596
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
	int	N, M, X;
	std::cin >> N >> M >> X;

	std::vector< int >	Ai( M );
	for( int i = 0; i < M; ++i ){
		std::cin >> Ai[ i ];
		assert( Ai[ i ] != X );
	}

	assert( N >= 1 && N <= 100 );//	1 <= N <= 100
	assert( M >= 1 && M <= 100 );//	1 <= M <= 100
	assert( X >= 1 && X <= N-1 );//	1 <= X <= N-1

	int	left = 0;	//	Xより左のAiのマス数
	int	right = 0;	//	Xより右のAiのマス数
	for( int i = 0; i < M; ++i ){
		if( Ai[ i ] < X )	left++;
		if( Ai[ i ] > X )	right++;
	}

	const int	nmin = std::min( left, right );
	std::cout << nmin << std::endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            var dic = new Dictionary<int, int>();
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            for (int i = 0; i < 8; i++)
            {
                dic.Add(i, 0);
                dic[i] += s.Count(x =>
                                    400 * i <= x && x < 400 * (i + 1));
                if (i > 1 && dic[i] - dic[i - 1] > 0) dic[i] -= dic[i - 1];
            }
           
            WriteLine(
                Max(1,dic.Count(x => x.Value >= 1)) + " " + (dic.Count(x => x.Value >= 1) + s.Count(x => x >= 3200))
                );
        }
    }
}

Measured memory_bytes: 13524
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int a, b, d, r;
  double f;
  cin >> a >> b;
  d = a/b;
  r = a%b;
  f = double(a)/double(b);
  printf("%d %d %.5f\n", d, r, f);
  return 0;
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

ll x[1234567], y[1234567];
signed main() {
	ll n, j = 0, o = 0, i = 0, ans = 0;
	string s; cin >> s; n = s.size();
	rep(h, n) {
		if (h == 0) {
			if (s[i] == 'J') { j++; }
		}
		else {
			if (s[h - 1] == s[h]) {
				if (s[h] == 'J') { j++; }
				if (s[h] == 'O') { o++; }
				if (s[h] == 'I') { i++; }
			}
			else {
				if (s[h - 1] == 'J' && s[h] == 'O') { o++; }
				else if (s[h - 1] == 'O' && s[h] == 'I') { i++; }
				else if (s[h - 1] == 'I') {
					if (min(j, min(o, i)) == o) { ans = max(ans, o); }
					j = 0; o = 0; i = 0;
					if (s[h] == 'J') { j++; }
				}
				else {
					j = 0; o = 0; i = 0;
					if (s[h] == 'J') { j++; }
				}
			}
		}
	}
	if (min(j, min(o, i)) == o) { ans = max(ans, o); }
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3980
#include <iostream>
#include <map>
using namespace std;
int main()
{
    int num;
    string com,key;
    map <string,int> a;
    cin>>num;
    for(int i=0;i<num;i++) {
        cin >> com>>key;
        if(com=="insert") a.insert(make_pair(key,i));
        if(com=="find")cout<<(a.find(key)!=a.end()?"yes":"no")<<endl;
    }
    return 0;
}


Measured memory_bytes: 36880
<?php
error_reporting(0);
fscanf(STDIN,"%s",$key->A[0]);
$f1 = array("eraser","erase");
$f2 = array("dreamer","dream");
$v = $key->A[0];
$len = strlen($v);
$v = str_replace($f1,"",$v);
$v = str_replace($f2,"",$v);
if ($v == "") {
  printf("YES\n");
}
else {
  printf("NO\n");
}


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	// 奇数だと無理
	if(n % 2 == 1){
		cout << 0;
		return 0;
	}

	// 2はいくらでも作れるので、5のみを考える
	int tmp = n;

	// 将来的に5がいくつ出る？
	long long int ans = 0;
	long long int w = 10;
	while(w <= n){
		ans += n / w;
		w *= 5;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] s = new int[m];
    int[] c = new int[m];
    int[] ans = new int[n];
    boolean[] flag = new boolean[n];
    for(int i = 0;i < m;i++){
      s[i] = sc.nextInt();
      c[i] = sc.nextInt();      
    }
    for(int x = 1;x <= n;x++){    
      for(int j = 0;j < m;j++){
        if(s[j] == x){
          if(flag[x-1] == true && c[j] != ans[x-1]){
            System.out.println("-1");
            System.exit(0);
          }
          ans[x-1] = c[j];
          flag[x-1] = true;
        }
      }
    }
    if(ans[0] == 0 && flag[0] == false) ans[0] = 1;
    if(ans[0] == 0 && flag[0] == true && n != 1){
      System.out.println("-1");
      System.exit(0);      
    }
    if(m == 0 && n == 1) ans[0] = 0;
    if(m == 0 && n != 1) ans[0] = 1;
    for(int p = 0;p < n;p++){
      System.out.print(ans[p]);
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    string s;
    cin >> s;
    int w;
    cin >> w;

    for (int i = 0; i * w < s.size(); ++i)
    {
        cout << s[i * w];
    }
    cout << "\n";

    return 0;
}



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

int main()
{
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << a[k - 1] << endl;
    return 0;
}

Measured memory_bytes: 3520
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
bool prime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main()
{
ll ans,q;

cin >> q;

int table[100002]={};


for(int i = 2; i < (int)(100002); i++){
    if(prime(i)&&prime((i+1)/2)){
        table[i]=table[i-1]+1; 
    }
    else{
        table[i]=table[i-1];
    }
}

int l,r;
rep(i,q){
    cin >> l>>r;
    ans=table[r]-table[l-1];
    cout << ans << endl;
}
return 0;
}





Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define mk make_pair
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);

int main()
{
  hs;
  ll a,b,ans=0,mm=1e9+7;
  cin>>a>>b;
  ll count=(a*(a+1))/2;
  //cout<<count<<endl;
  for(ll i=b-1;i<=a;i++)
  {
    ll count1=0,count2=0;
    count1=(i*(i+1))/2;
    count2=((a-i-1)*(a-i))/2;

    ans+=((count-count2)-count1+1);
  }
  cout<<ans%mm<<endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int A, B;
    cin >> A >> B;
    
    cout << 6 - A - B << "\n";
    return 0;
}


Measured memory_bytes: 256
n = int(input())
values = list(map(int, input().split()))
# values = [i for i in range(5)]

allXor = 0


def output_b(v):
    return format(v, '08b') +":" + format(v)

for a in values:
    allXor = allXor ^ a

for a in values:
    result = allXor ^ a
    print(result)


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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

ll A[100000];

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

  ll N, M;
  cin >> N >> M;
  vector<pair<ll, ll>> cost(N);
  REP(i, N){
    cin >> cost[i].first >> cost[i].second;
  }
  sort(cost.begin(), cost.end());
  ll ans = 0;
  ll current_m = 0;
  REP(i, N){
    current_m += cost[i].second;
    ans += cost[i].second * cost[i].first;
    if(current_m >= M){
      ans -= cost[i].first * (current_m - M);
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

N,M = II()
A,B = Line(N)
a = []
for i in range(N):
  a.append([A[i],B[i]])
a.sort(key = lambda x:(x[0],x[1]))

b = []
for i in range(N):
  b.append([-a[i][1], a[i][0]])

from bisect import bisect_left, bisect_right
import heapq

ans = 0
h = []

for i in range(1,M+1):
  left = bisect_left(a,[i,0])
  right = bisect_right(a,[i,float('inf')])-1
  if right-left>=0:
    for i in range(left,right+1):
      heapq.heappush(h,b[i])
    x = heapq.heappop(h)
    ans += -x[0]
  else:
    if h:
      x = heapq.heappop(h)
      ans += -x[0]

print(ans)

Measured memory_bytes: 35748
/**
 *      ABC 74 A
 *      author  : kyomukyomupurin
 *      created : 2018-09-04 16:48:40
**/

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, A; cin >> N >> A;
    cout << N * N - A << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,wz,w[110],v[110],dp[100010];
inline int read(){
     int x=0,f=1;char ch=getchar();
     while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
     while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
     return x*f;
 }
int main ( )
{
	n=read();wz=read();
	for(int i=1;i<=n;i++) w[i]=read(),v[i]=read();
	for(int i=1;i<=n;i++)
	   for(int j=wz;j>=w[i];j--)
	      dp[j]=std::max(dp[j],dp[j-w[i]]+v[i]);
	cout<<dp[wz];
	return 0;
	     
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<map>
using namespace std;
const int maxn = 2e6 + 10;
typedef pair<int, int> P;
int fa[maxn], ma[maxn];
void init(int n){
    for(int i = 0; i <= n; ++ i){
        fa[i] = i;
        ma[i] = i;
    }
}
int find(int* fa, int x){
    if(fa[x] == x){
        return fa[x];
    }
    return fa[x] = find(fa, fa[x]);
}
void unin(int a, int b, int* fa){
   a = find(fa, a);
   b = find(fa, b);
   fa[a] = b;
}
map<P, int>ans;
int main(){
    int n, k, l;
    while(scanf("%d%d%d", &n, &k, &l) != EOF){
        init(n);
        ans.clear();
        for(int i = 0; i < k; ++ i) {
            int a, b;
            scanf("%d%d", &a, &b);
            unin(a, b, ma);
        }
        for(int i = 0; i < l; ++ i){
            int a, b;
            scanf("%d%d", &a, &b);
                unin(a, b, fa);
        }
        for(int i = 1; i <= n; ++ i){
            ans[make_pair(find(ma, i), find(fa, i))]++;
        }
        for(int i = 1; i <= n; ++ i){
            i == n ? printf("%d\n", ans[make_pair(find(ma, i), find(fa, i))]) : printf("%d ", ans[make_pair(find(ma, i), find(fa, i))]);
        }
    }
    return 0;
}

Measured memory_bytes: 14080
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

long long n, k;

bool C(long long x){
    rep(i,n - 1){
        x = x - (x - 1) / k - 1;
        if(x <= 0) return true;
    }
    return false;
}

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

    long long right = 1e18, left = 0;
    rep(i,200){
        long long mid = (right + left ) / 2;
        if(C(mid)) left = mid;
        else right = mid;
    }
    cout << left << endl;
}

Measured memory_bytes: 3072
#include<cstdio>
#include<cstring>

int r[105];
int c[105];
int cache[105][105];

int f(int a, int b){
	if(a==b)
		return 0;
	if(cache[a][b] == -1)
	{
		cache[a][b] = 1000000000; 
		for(int i = a; i<b; i++){
			int res = f(a,i) +f(i+1, b) +r[a]*c[i]*c[b];
			if(res<cache[a][b])
				cache[a][b] = res;
		}
	}
	return cache[a][b];
	
}

int  main(){
	int n;
	scanf("%d",&n);
	for(int i = 0; i<n; i++){
		scanf("%d %d",&r[i], &c[i]);	
	}
	memset(cache, -1, sizeof(cache));
	printf("%d\n",f(0,n-1));
}


Measured memory_bytes: 2800
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
int Sum;
char S[300000];
char c;
int main()
{
  for(;;)
  {
    scanf("%c", &c);
    if(c=='\n')
      break;
    else
      Sum+=c-'0';
  }
  printf("%s", Sum%9==0?"Yes":"No");
  return 0;
}

Measured memory_bytes: 3684
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int
#define pp pair<pii,pii>
const int hell =998244353;



int power(int a,int b)
{
  if(b==0)return 1;
  if(b==1)return a;
  int t=power(a,b/2);
  t%=hell;
  t*=t;
  t%=hell;
  if(b%2)return (t*a)%hell;
  else
     return t;
}

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

int digitsum(int x)
{
  while(x>9)
    {  int ans=0;
       while(x!=0)
       {
        ans+=x%10;
        x/=10;
       }
       x=ans;
    }
    return x;
}

int pw(int a,int b)
{
  int x=a;
  rep(i,1,b){a=a*x;}
  return a;
}

int solve( ){

string s;
cin>>s;
int a=s[0]-48;
a*=10;
a+=s[1]-48;
int b=s[2]-48;
b*=10;
b+=s[3]-48;
//cout<<a<<" "<<b<<endl;
if(a>=1&&a<=12&&b>=1&&b<=12)
{
  cout<<"AMBIGUOUS";return 0;
}
if(a>=1&&a<=12)
{
  cout<<"MMYY";return 0;
}
if(b>=1&&b<=12)
{
  cout<<"YYMM";return 0;
}
cout<<"NA";


return 0;
}

signed main()
{  int t=1;
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   cin.exceptions(cin.failbit);                                                                    


  clock_t time_req;

    // Without using pow function
                                                                                                                   

    //cin>>t;

    int k=1;
   while(t--)
     {
       //cout<<"case #"<<k<<":"<<" ";k++;
      solve();
     }

         time_req = clock() - time_req;
    //cout <<endl<< "Processor time taken is "
      //<< (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;


    return 0;
} 

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

typedef long long ll;

int main() {
	int n, m;
	cin >> n >> m;
	char v[n][m];
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> v[i][j];
		}
	}
	for (int i = 0; i < n; ++i) {
		int t = 2;
		while (t--) {
			for (int j = 0; j < m; ++j) {
				cout << v[i][j];
			}
			cout << endl;
		}
	}
}



















Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define in() ( { int a ; scanf("%d",&a); a; } )
 
const int N = 3e5 + 9;
const int mod = 1e9 + 7;
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};
int chk[N], WA[N];
int main()
{
    int n, m, i, j, cnt = 0, p, wa = 0, ac = 0;
    string s;
    cin >> n >> m;
    for (i = 0; i < m; i++){
        cin >> p >> s;
        if(chk[p]){
            continue;
        }
        if(s == "WA"){
            WA[p]++;
        }
        else{
            ac++;
            chk[p] = 1;
            wa += WA[p];
        }
    }
    cout << ac << " " << wa << nl;
}

Measured memory_bytes: 1024
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end();
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int main() {
	int a, b, c, d, e;
	std::cin >> a >> b;
		std::cout<<b*2-a<<std::endl;
	return 0;
}

Measured memory_bytes: 256
s = int(input())
num = [0]*1000006
num[s] = 1
a = []
a.append(s)
for i in range(1, 1000001):
    if a[-1] % 2 == 0:
        tmp = a[-1] // 2
    else:
        tmp = 3 * a[-1] + 1
    a.append(tmp)
    
    if num[tmp] == 1:
        print(i + 1)
        exit()
    
    num[tmp] = 1


Measured memory_bytes: 16792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, MAX = 99999;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> A;
    int counter = 0;
    while (true) {
      if (A % 2 == 0) {
        A /= 2;
        counter += 1;
      }
      else {
        if (MAX > counter) {
          MAX = counter;
        }
        break;
      }
    }
  }
  
  cout << MAX << endl;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s,t;
    cin >> n;
    cin >> s >> t;
    rep(i,0,s.size()){
        cout << s[i] << t[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  double N;
  cin>>N;
  int n=int(N);
  if(n%2==0)
    cout<<N/2.0/N<<endl;
  else
    cout<<(N+1)/2/N<<endl;
  


}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main()
{
    int N;
    cin>>N;
    vector<vector<int>> xy(15,vector<int>(15, -1));

    vector<int> A(N);
    REP(i,N){
        cin>>A[i];
        REP(j,A[i]){
            int x, y;
            cin >> x>>y;
            x--;
            xy[i][x] = y;
        }
    }

    int max_cnt = 0;

    // 正直者を仮定する
    REP(bit, 1<<N){
        

        // i番目の人の証言に矛盾がないか確認する
        bool flg = true;    // 証言が正しくない場合はflg=falseになる
        REP(i, N){
            if(!(bit&1<<i)) continue;   // 正直者ではないと仮定した人はスルー

            // 証言内容を確認
            REP(j, N){

                // 正直者と仮定したj番目の人を、正直者ではないと証言した場合
                if((bit&(1<<j))&&xy[i][j]==0){  
                    flg=false;
                    break;
                }

                // 正直者ではないと仮定したj番目の人を、正直者と証言した場合
                if(!(bit&(1<<j))&&xy[i][j]==1) {
                    flg=false;
                    break;
                }
            }
        }
        if(flg){
            //cout<<bitset<3>(bit)<<endl;
            int cnt=0;
            REP(c, N){
                if(bit&1<<c) cnt++;
            }
            if(max_cnt< cnt) max_cnt=cnt;
        }
    }


    cout << max_cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long int fun(long long x,long long int a,long long b)
{
	long long int d,e;
	if(a%x==0) d=a/x;
	else d= a/x +1;
	e=b/x;
	 
	return e-d+1;
}
int gcd(int a,int b)
{
	if(b==0) return a;
	else gcd(b,a%b);
}
int main()
{
  long long a,b,c,d;
  cin>>a>>b>>c>>d;
  long long h=fun(c,a,b);
  
  long long j=fun(d,a,b);
  
  long long cd=c*d/gcd(c,d);
  
  long long k=fun(cd,a,b);
  
  cout<<b-a-h-j+k+1;

}

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

int main() {
  ll n,k;cin>>n>>k;
  ll cnt=0;
  for(ll j=k;j<=n+1;j++) {
    ll a=j*(j-1)/2;
    ll b=(2*n-j+1)*j/2;
    cnt = (cnt + b - a + 1) % MOD;
    //cout << a<<" "<<b<<" "<<b-a+1 << endl;
  }
  cout<<cnt;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  string s;
  cin>>s;
  cout<<s.substr(0,3);
}

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

int main() {
	int H, W;
	while (1) {
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		else {
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i < H - 1 && i > 0 && j < W - 1 && j > 0) {
						printf(".");
					}
					else {
						printf("#");
					}
				}
				printf("\n");
			}
		}
		printf("\n");

	}
	return 0;
}

Measured memory_bytes: 2984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    /*if(a%2==0&&c%2!=0){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }*/
    int x;
    int ans=0;
    for(int i=1;i<=100;i++){
        x=i*a;
        if(x%b==c){ 
            ans++;
            break;
        }
    }
    if(ans==0){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    int edge[3];
    cin >> n;
    while (n--) {
        cin >> edge[0] >> edge[1] >> edge[2];
        sort(edge, edge+3);
        int t = pow(edge[0], 2) + pow(edge[1], 2);
        double x = sqrt(t);
        if (x == edge[2]) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


Measured memory_bytes: 3060
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

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

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:usize = read();
    let mut p:Vec<u32> = (0..n).map(|_| read()).collect();

    p.sort();
    p.reverse();
    //debug!(p);

    println!("{}", p[0]/2 + p.iter().skip(1).sum::<u32>());

}


Measured memory_bytes: 4352