akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>

"""
from __future__ import division, print_function

import itertools
import os
import sys
from atexit import register
from io import BytesIO


class dict(dict):
    """dict() -> new empty dictionary"""

    def items(self):
        """D.items() -> a set-like object providing a view on D's items"""
        return dict.iteritems(self)

    def keys(self):
        """D.keys() -> a set-like object providing a view on D's keys"""
        return dict.iterkeys(self)

    def values(self):
        """D.values() -> an object providing a view on D's values"""
        return dict.itervalues(self)


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


range = xrange

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))

input = lambda: sys.stdin.readline().rstrip('\r\n')


def main():
    n = int(input())
    t = 0.0
    for i in range(n):
        x, u = input().split()
        if u == 'BTC':
            t += float(x) * 380000
        else:
            t += int(x)
    print(t)


if __name__ == '__main__':
    main()


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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M) = Slice2<int>();
            var pi = Sarray();
            var uf = new UnionFind(N + 1);
            for (var i = 0; i < M; ++i)
            {
                var (x, y) = Slice2<int>();
                uf.merge(x, y);
            }
            var cnt = 0L;
            for (var i = 0; i < N; ++i)
                if (uf.issame(i + 1, (int)pi[i])) ++cnt;
            WriteLine(cnt);
        }
        class UnionFind
        {
            int[] par;
            public UnionFind(int n)
            {
                init(n);
            }
            public void init(int n)
            {
                par = new int[n];
                for (var i = 0; i < n; ++i) { par[i] = -1; }
            }
            public int root(int x)
            {
                if (par[x] < 0) return x;
                else return par[x] = root(par[x]);
            }
            public bool issame(int x, int y)
            {
                return root(x) == root(y);
            }
            public bool merge(int x, int y)
            {
                x = root(x);
                y = root(y);
                if (x == y) return false;
                if (par[x] > par[y])
                {
                    var tmp = y;
                    y = x;
                    x = tmp;
                }
                par[x] += par[y];
                par[y] = x;
                return true;
            }
            public int size(int x)
            {
                return -par[root(x)];
            }
        }


        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 45368
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
using namespace std;
typedef long long ll;
//ll mod = 1e9+7;
ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n, k;
    cin >> n >> k;
    vector<ll> a_accum(n+1);
    a_accum[0] = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        a_accum[i+1] = a_accum[i] + a;
    }
    vector<ll> check_num_list;
    rep(i, n) {
        for ( int j = i; j < n; ++j ) {
            ll tmp_num = a_accum[j+1] - a_accum[i];
            check_num_list.push_back(tmp_num);
        }
    }
    ll ans = 0;
    for ( int i = 39; i >= 0; --i ) {
        ans += 1LL<<i;
        int cnt = 0;
        for ( auto tmp_num : check_num_list ) {
            if ( ( ans & tmp_num ) == ans ) {
                ++cnt;
            }
        }
        if ( cnt < k ) {
            ans -= 1LL<<i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6388
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define rep(i,n) for(int64_t i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr int64_t INF=(1ll<<60);
constexpr int64_t mod=1000000007;
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll n,k;cin>>n>>k;
    ll ans=0;
    if(n==0){
        cout<<1<<endl;
        return 0;
    }
    while(n!=0){
        n/=k;
        ans++;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3604
#include<iostream>

using namespace std;

int main(){
  int N,M,T,a[100],ans=0,sa;
  while(1){
    cin>>N;
    cin>>M;
    cin>>T;
    for(int lop=0;lop<N;lop++){
      cin>>a[lop];
    }
    ans=T;
    ans-=M*N*2;
    if(T<a[N-1]+M){
      ans=ans+( (a[N-1]+M) -T);
    }
    for(int lop=0;lop<N-1;lop++){
      if( (a[lop+1]-a[lop])<M*2 ){
        ans=ans+((M*2)-(a[lop+1]-a[lop]));
      }
    }


    cout<<ans<<endl;
    for(int lop=0;lop<N;lop++){
      a[lop]=0;
    }
    ans=0;
    break;
  }

  return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n;
	lli m;
	cin>>n>>m;

	lli data[100010]={0};

	REP(i,0,m){
		lli tmp;
		cin>>tmp;
		data[tmp]=-1;
	}

	data[0]=1;
	for(lli i=1;i<=n;i++){
		if(data[i]==-1)continue;
		if(data[i-1]!=-1)data[i]+=data[i-1]%MOD;
		if(i!=1){
			if(data[i-2]!=-1)data[i]+=data[i-2]%MOD;
		}
	}

	cout<<data[n]%MOD<<endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define CTOI(x) (x - 'A') 
#define ctoi(x) (x - 'a')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;
}

LL exp(LL a, LL b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum) % MOD;
        sum = (sum * sum) % MOD;
        b>>=1;
    }
    return res;
}

int count(int x){
    int res = 0;
    while(x){
        res += x & 1;
        x>>=1;
    }
    return res;
}

int main(){
    int N;
    while(cin >> N && N){
        vector<vector<int> > m(21, vector<int>(21, 0));
        REP(i, N){
            int x;
            int y;
            cin >> x >> y;
            ++m[x][y];
        }
        int count = 0;
        int M;
        cin >> M;
        int nx, ny;
        nx = ny = 10;
        REP(i, M){
            char D;
            int l;
            cin >> D >> l;
            REP(j, l){
                if(D == 'N')++ny;
                if(D == 'S')--ny;
                if(D == 'E')++nx;
                if(D == 'W')--nx;
                if(m[nx][ny]){
                    count += m[nx][ny];
                    m[nx][ny]=0;
                }
            }
        }
        cout << (N == count?"Yes":"No") << endl;
    }
    return 0;
}



Measured memory_bytes: 3044
s = input()
a = 0
z = 0

for i in range(len(s)):
    if s[i] == "A":
        a = i
        break
for i in range(len(s) - 1, -1, -1):
    if s[i] == "Z":
        z = i
        break
print(len(s[a:z+1]))


Measured memory_bytes: 40560
#include <iostream>
using namespace std;
int main() {
  long long a,b,c,k;
  cin >> a >> b >> c >> k;
  if (k <= a) {
    cout << k << endl;
  } else if (k <= a + b) {
    cout << a << endl;
  } else {
    cout << a - (k - a - b) << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

typedef unsigned long long ullong;

int main()
{
    int n;
    cin >> n;
    ullong *h = new ullong[n];
    for (size_t i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    int count = 0;
    int max_count = 0;
    for (size_t i = 1; i < n; i++)
    {
        if (h[i] > h[i - 1])
        {
            max_count = max(max_count, count);
            count = 0;
        }
        else
        {
            count++;
        }
    }
    max_count = max(max_count, count);

    cout << max_count << endl;

    delete[] h;
}


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

int main(){
    int N, M;  cin >> N >> M;
    vector<int> A(N), B(M);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<M; i++) cin >> B[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    for(int i=1; i<N; i++) if(A[i]==A[i-1]){ puts("0");  return 0; }
    for(int i=1; i<M; i++) if(B[i]==B[i-1]){ puts("0");  return 0; }

    int mod = 1e9+7;
    ll ans = 1;
    for(int i = N*M; i>=1; i--){
        if(binary_search(A.begin(),A.end(),i) && binary_search(B.begin(),B.end(),i)) continue;
        else if(binary_search(A.begin(),A.end(),i)){
            ans = (ans*(B.end() - lower_bound(B.begin(),B.end(),i)))%mod;
        }else if(binary_search(B.begin(),B.end(),i)){
            ans = (ans*(A.end() - lower_bound(A.begin(),A.end(),i)))%mod;
        }else{
            int h = A.end() - lower_bound(A.begin(),A.end(),i);
            int w = B.end() - lower_bound(B.begin(),B.end(),i);
            ans = (ans * (h*w - (N*M - i)))%mod;
        }
        if(ans == 0) break;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int x;cin >> x;
    if(x==0)cout << 1 << endl;
    else cout << 0 << endl;
    return 0;

}


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;




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

	 int n;cin>>n;

	 vector<int> d(n);

	 int sum =0;
	 rep(i,n){
		 cin>>d[i];
		 sum += d[i];
	 }
	 int nsum =0;
	 int ans=100000000;
	 rep(i,n){
		 nsum +=d[i];

		 ans = min(ans,abs((sum-2*nsum)));

	 }
	 writeln(ans);

}


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

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define THINK_TWICE_CODE_ONCE cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n)+1) : 1)
#define mem(x, val)    memset(x, val, sizeof(x))
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef double dd;
typedef string str;
typedef pair<int, int> pii;


int main()
{
    THINK_TWICE_CODE_ONCE
    //freopen("test cases\\.txt", "r", stdin) ;
    int n, l; cin>>n>>l;
    vector<string> v(n);
    for(int i =0; i<n; i++) cin>>v[i];
    sort(all(v));
    for(auto &it: v)
        cout<<it;
	return 0;

}


Measured memory_bytes: 256
/**
 * Created by iainws on 4/09/16.
 */

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReaderMain in = new InputReaderMain(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskMain solver = new TaskMain();
        solver.solve(1, in, out);
        out.close();
    }
}
class TaskMain {
    public boolean check(int cur, int [] arr){
        boolean ok = true;
        while(cur != 0){
            int r = cur % 10;
            for(int i = 0; i < arr.length; ++i){
                if(arr[i] == r)ok = false;
            }
            cur /= 10;
        }
        if(ok)return true;
        return false;
    }

    public void solve(int taskNumber, InputReaderMain in, PrintWriter out) {
        int N;
        int K;
        N = in.nextInt();
        K = in.nextInt();
        int [] arr = new int[K];
        for(int i = 0; i < K; ++i){
            int a = in.nextInt();
            arr[i] = a;
        }
        for(int i = N; i < N * 10;++i){
            if(check(i, arr)){
                System.out.println(i);
                return;
            }
        }
    }
}

class InputReaderMain {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReaderMain(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: 8404
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n; cin >> n;
  int a[n];
  for ( int i = 0; i < n; i++) cin >> a[i];
  
  bool increase = true;
  if(n > 1){
    for ( int i = n; i > 0; i--){
      if(a[i-1] - a[i] > 1) increase = false;
      else if (a[i-1] - a[i] == 1) a[i-1] -= 1;
    }
  }
  
  if(increase) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
N, K = map(int, input().split())
candles = list(map(int, input().split()))

min_time = 2 * abs(candles[0] - candles[-1])

for i in range(N):
    end_index = i + K - 1
    if end_index >= N:
        break
    left_end = candles[i]
    right_end = candles[end_index]
    d = abs(right_end - left_end)

    time = min(abs(left_end) + d, abs(right_end) + d)
    min_time = min(time, min_time)

print(min_time)


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

int n;
char s[55];

int main() {
    scanf("%d%s", &n, s);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (i + 2 >= n) break;
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ++ans;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
S = input()
n = len(S)
ans = [0]*(n+1)

for i in range(n):
  for j in range(i+1):
    ans[i+1] += ans[i-j] + int(S[i-j:i]+S[i])*(2**(i-j-1 if i-j-1 >= 0 else 0))
    #print(S[i-j:i] + " " + S[i])
    #print(int(S[i-j:i]+S[i]))
print(ans[n])

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	switch {
	case n < 600:
		fmt.Println(8)
	case 600 <= n && n < 800:
		fmt.Println(7)
	case 800 <= n && n < 1000:
		fmt.Println(6)
	case 1000 <= n && n < 1200:
		fmt.Println(5)
	case 1200 <= n && n < 1400:
		fmt.Println(4)
	case 1400 <= n && n < 1600:
		fmt.Println(3)
	case 1600 <= n && n < 1800:
		fmt.Println(2)
	case 1800 <= n && n < 2000:
		fmt.Println(1)

	}
}


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

int main() {
	long long N, K;
	cin >> N >> K;
	long long ans = 0;
	long long t = N / K;
	ans = t*t*t; 
	// Kがevenならば余りがK/2となる数も(a,b,c)の各要素となりうる。
	if (K % 2 == 0) {
		// 1からNの間にK/2の倍数がいくつ含まれるか。
		// N / Kより1つ多くなるか、同一かで場合分け.
	 	if (N % K >= K/2) ans += (t+1)*(t+1)*(t+1);
		else ans *= 2;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
          float x1,y1,x2,y2,x3,y3,x4,y4,a,b,c,d,e,f,g,h,i;
          cin>>a;
          for(i=0;i<a;i++)
          {
                    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
                    b=((y2-y1)/(x2-x1));
                    c=((y4-y3)/(x4-x3));
                    if(b==c)
                              cout<<"YES\n";
                    else
                              cout<<"NO\n";
          }
return 0;
}



Measured memory_bytes: 3204
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

    class Program
    {

        
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            
            for(int i = str.Length - 1; i >= 0; i--)
            {
                Console.Write(str[i]);
            }
            Console.WriteLine();
        }
    }
}



Measured memory_bytes: 15832
n = int(input())
s = input()

cnt = 0
for i in range(1000):
	sec = str('%03d' % i)
	if sec[0] in s and sec[1] in s and sec[2] in s:
		nex = 0
		for j in range(n):
			if nex == 0 and s[j] == sec[0]:
				nex += 1
			elif nex == 1 and s[j] == sec[1]:
				nex += 1
			elif nex == 2 and s[j] == sec[2]:
				cnt += 1
				break
print(cnt)



Measured memory_bytes: 42588
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {

var inputs = chunk.toString().trim().split('\n').map(Number);
 var inputs = chunk.toString().trim().split('\n').map(Number);
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i] === 0) {
            break;
        }
        console.log('Case ' + (i + 1) + ': ' + inputs[i]);
    }

});

Measured memory_bytes: 20900
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<ll> VL;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)

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

  int r, D, x;
  cin >> r >> D >> x;

  for (int i = 1; i <= 10; ++i) {
    x = r * x - D;
    cout << x << endl;
  }
}


Measured memory_bytes: 256
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  int x = 0, y = 0;
  for(char c : s) {
    if('A' <= c and c <= 'M') y++;
    else if('N' <= c and c <= 'Z') y--;
    else if('a' <= c and c <= 'm') x++;
    else x--;
  }
  string a;
  while(x>0) a += 'm',x--;
  while(x<0) a += 'n',x++;
  while(y>0) a += 'M',y--;
  while(y<0) a += 'N',y++;
  cout << a.size() << endl;
  cout << a << endl;
  return 0;
}



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

int main(void) {
	int S; cin >> S;
	int h, m, s;
	h = S / 3600;
	m = (S - (h * 3600)) / 60;
	s = (S - (h * 3600) - (m * 60));
	
	cout << h << ":" << m << ":" << s << endl;

	return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n,m;
    string o,e;
    cin>>o>>e;
    //cerr<<o<<" "<<e<<endl;
    n=o.length();
    m=e.length();
    n=n+m;
    ll i=0,j=0,k=0;
    for(k=0;k<n;k++)
    {
      if(k%2==0)
        {
          cout<<o[i];
          i++;}
          else
          {
            cout<<e[j];
              j++;
          }
    }
}
return 0;
}

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

int64_t cnt_div(int64_t a, int64_t b, int64_t n) {
  int64_t ma = b/n;
  int64_t mi = (a-1)/n+1;

  return ma-mi+1;
}

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

  int64_t lcm = c/__gcd(c,d)*d;

  int64_t sum = cnt_div(a,b,c) + cnt_div(a,b,d) - cnt_div(a,b,lcm);

  int64_t ans = b-a+1-sum;

  cout<<ans<<endl;


  return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int time1 = h1 * 60 + m1;
    int time2 = h2 * 60 + m2;
    int ans = time2 - time1 - k;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>

using namespace std;


int main() {
	string s;
	long long k;
	
	cin >> s >> k;
	
	for(int i=0;i<s.length();i++){
		if(i == k-1 || s[i] != '1') {
			cout << s[i] << "\n";
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >> n;
	vector<ll> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	ll sum=0;
	int ma=0;
	for(int i=0;i<n;i++){
		if(sum*2<a[i]){
			ma=i;
		}
		sum+=a[i];
	}
	cout << n-ma << endl;
}

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>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define vin(v,n) rep(i,n)cin>>v[i];
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define sz size()
#define fi first
#define se second
#define pb push_back
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll n, m, a, b;
vector<ll>edge[8];
ll dfs(ll p, bitset<8>b2) {
	bitset<8>b = b2;
	b[p] = 1;
	bool fl = 1;
	rep(i, n)fl &= b[i];
	if(fl)return 1;
	ll ans = 0;
	rep(i, edge[p].sz) {
		if (!b[edge[p][i]]) ans += dfs(edge[p][i], b);
	}
	return ans;
}
int main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> a >> b;
		edge[a - 1].pb(b - 1);
		edge[b - 1].pb(a - 1);
	}
	bitset <8> b = {};
	cout << dfs(0, b) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int arr[102];
int main()
{
    long long int a,b,c,i,j,k,l,m,t,n,sum,temp,ans;
    cin>>n;
    sum=0;
    temp=0;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        sum+=arr[i];
    }
    for(i=0;i<n;i++)
    {
        if(temp+arr[i]>=sum-arr[i])
        {
            a=abs(temp+arr[i]-sum+arr[i]);
            b=sum-temp;
            ans=min(a,b);
            break;
        }
        else
        {
            temp+=arr[i];
            sum-=arr[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    int ans = 0;
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    sort(L.begin(), L.end());
    rep(a,N) rep(b,a){
        int r = lower_bound(L.begin(), L.end(), L[a]+L[b]) - L.begin();
        int l = a+1;
        ans += max(0, r-l);
    }
    cout << ans << endl;
    return 0;
}

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



int main(){

    string S, T; cin >> S >> T;
    int A, B; cin >> A >> B;
    string U; cin >> U;

    if(S==U){
        A--;
    }else if(T==U){
        B--;
    }

    cout << A << " "  << B << endl; 

    return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    const [A, B, C] = arg.split("\n")[0].split(" ");
  
    let flg = false;
    
    for(let i=0; i<B; i++) {
        if((A * i - C) % B === 0) {
            flg = true;
        }
    }
    
    console.log(flg ? "YES" : "NO");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mp(x,y) make_pair(x,y)
const int nax=1e6+5;
ld pie=3.141592653589793238;

void solve(){
    int n,m;
    cin>>n>>m;
    vector<int> v[n];
    for(int i=0;i<m;i++){
        int x,y; cin>>x>>y;x--; y--;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    int vis[n]={0};
    queue<int> q;
    vis[0]=1;
    q.push(0);
    int p[n];
    while(q.size() > 0){
        int ci=q.front();
        q.pop();
        vis[ci]=1;
        for(auto  x: v[ci]){
            if(vis[x]==1) continue;
            p[x]=ci;
            q.push(x);
            vis[x]=1;
        }
    }
    cout<<"Yes\n";
    for(int i=1;i<n;i++){
        cout<<p[i]+1<<'\n';
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int tc;
    tc=1;
    cout<<fixed<<setprecision(20);
    while(tc--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 10868
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)

int main(void)
{
  int N, K;
  int value[51], have[51] = {0}, size = 0;

  scanf("%d %d", &N, &K);

  int i, ki, ni;
  for (ni = 0; ni < N; ni++)
    scanf("%d", &value[ni]);

  int head, rear;
  int max = 0, sum;
  int tresures = min(N, K);
  for (head = 0; head <= N; head++)
  {
    for (rear = N - 1; rear >= -1; rear--)
    {
      if (head + (N - 1 - rear) > N)
        continue;
      if (head + (N - 1 - rear) > K)
        continue;
      sum = 0;
      size = 0;
      for (i = 0; i < head; i++)
      {
        sum += value[i];
        have[size++] = value[i];
      }
      for (i = N - 1; i > rear; i--)
      {
        sum += value[i];
        have[size++] = value[i];
      }
      qsort(have, size, sizeof(int), acs);
      i = K - head - (N - 1 - rear);
      ki = 0;
      while (i > 0 && have[ki] < 0 && ki < size)
      {
        sum -= have[ki++];
        i--;
      }
      max = max(max, sum);
    }
  }
  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;
typedef pair<ll,ll> pairs;
typedef vector<pairs> p;


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<vector<ll>> combination(ll n, ll r){
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for(ll i=0;i<v.size();++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(ll i=1;i<v.size();++i){
        for(ll j=0;j<i;++j){
            v[i][j] = (v[i - 1][j - 1] + v[i - 1][j]);
        }
    }
    return v;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    string s, t;
    cin>>s>>t;

    string ans = "UNRESTORABLE";
    bool flag = false;
    vector<string> q;
    for(ll i=0;i<s.size()-t.size()+1;++i){
        ll x = 0;
        string y;
        for(ll j=0;j<t.size();++j){
            if(s[i+j] == t[j] or s[i+j] == '?'){
                x++;
            }
        }

        if(x == t.size()){
            y = s.substr(0, i);
            for(ll j=0;j<t.size();++j){
                y += t[j];
            }
            y += s.substr(i+t.size());
            for(ll j=0;j<s.size();++j){
                if(y[j] == '?'){
                    y[j] = 'a';
                }
            }
            q.push_back(y);
        }
    }
    sort(q.begin(), q.end());

    if(q.size() == 0){
        cout<<ans<<endl;
    }else{
        cout<<q[0]<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

int main()
{
	int n,m,x;
	cin>>n>>m>>x;
	vector<int> cost;
	vector<vector<int> > books(n+1);
	
	for(int i = 0;i<n;i++)
	{
		int c;cin>>c;
		cost.push_back(c);
		for(int j = 0;j<m;j++)
		{
			int y;s(y);
			books[i].push_back(y);	
		}	
	}
	
	int last = (1<<n)-1;

	int mini = INF;
	
	for(int i = 0;i<=last;i++)
	{
		vector<int> algo(m+1 , 0);
		int costs = 0;
		
		for(int j = 0;j<n;j++)
		{
			int bit = (i & (1<<j));
			if(bit)
			{
				for(int k = 0;k<m;k++)
				{
					algo[k]+=books[j][k];		
				}		
				
				costs+=cost[j];
			}
		}
		
		bool is_possible = true;
		for(int j = 0;j<m;j++)
		{
			if(algo[j] < x) is_possible = false;
		}
		
		if(is_possible)
		{
			mini = min(mini , costs);
		}
	}
	
	if(mini == INF)
	{
		cout<<-1<<endl;
	}
	else
	{
		cout<<mini<<endl;
	}
	return 0;
}

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

#define __INIT_CC__ ios::sync_with_stdio(false); \
	cin.tie(0);

#ifdef __WIN32__
	char getchar_unlocked() {return getchar();}
#endif

#define FOR(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<(_t);++(_i))
#define FORN(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<=(_t);++(_i))
#define FORD(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i>=(_t);--(_i))
#define RESET(_a,_value) memset(_a,_value,sizeof(_a))
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define mp make_pair
#define SIZE(_a) (int)_a.size()
#define VSORT(_a) sort(_a.begin(),_a.end())
#define SSORT(_a,_val) sort(_a,_a+(_val))
#define ALL(_a) _a.begin(),_a.end()
#define mt make_tuple
#define _get(_tuple,_i) get<_i>(_tuple)
#define eb emplace_back
 
using namespace std;

using vi = vector<int>;
using ii = pair<int,int>;
using vii = vector<ii>;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll,ll>;
using vpll = vector<pll>;
using vll = vector<ll>;
using pdd = pair<double,double>;
using vpdd = vector<pdd>;
template <typename T> using uset = unordered_set<T>;
template <typename T> using umultiset = unordered_multiset<T>;
template <typename K, typename V> using umap = unordered_map<K, V>;
template <typename K, typename V> using umultimap = unordered_multimap<K, V>;

const int dr[] = { 1, 0,-1, 0, 1, 1,-1,-1};
const int dc[] = { 0, 1, 0,-1, 1,-1,-1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const ll INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);

template <typename T> T take(queue<T> &O) {T tmp=O.front();O.pop();return tmp;}
template <typename T> T take(stack<T> &O) {T tmp=O.top();O.pop();return tmp;}
template <typename T> T take(priority_queue<T> &O) {T tmp=O.top();O.pop();return tmp;}
template <typename T>
inline bool inRange(const T& z, const T& a, const T& b){return a <= z && z <= b;}

void OPEN(const string& in = "input.txt", const string& out = "output.txt")
{
	freopen(in.c_str(), "r", stdin);
	freopen(out.c_str(), "w", stdout);
	return ;
}

//using sokokaleb's template v4.0

const int MAX_NODE = 200005;
int N;
ll L;
string s;
int go[MAX_NODE][2], node_count = 1;
int _terminate[MAX_NODE];

void insert(const string& s) {
	int now = 0;
	for (auto c : s) {
		int to = c - '0';
		int& go = ::go[now][to];
		if (go == -1) {
			go = node_count++;
		}
		now = go;
	}
	_terminate[now] = 1;
}

ll traverse(int pos, ll h) {
	if (pos == -1) {
		return h & -h;
	}
	if (_terminate[pos]) return 0;
	ll res = 0LL;
	FOR (i, 0, 2) {
		int go = ::go[pos][i];
		res ^= traverse(go, h - 1);
	}
	return res;
}

int main(int argc, char** argv) {
	__INIT_CC__
	RESET(go, -1);
	cin >> N >> L;
	FOR (i, 0, N) {
		cin >> s;
		insert(s);
	}
	if (traverse(0, L + 1) == 0LL) cout << "Bob\n";
	else cout << "Alice\n";
}


Measured memory_bytes: 5200
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int main()
{
	ll a,b,c,k;cin >> a >> b >> c >> k;
	ll res = 0;
	
	res = min(a,k);
	k -= a;
	if(k > 0)
	{
		k -= b;
		if(k > 0)
			res -= k;
	}
	cout << res;
    return 0;
}


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

int N;
int x[10], y[10];

double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}

void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];
    double sum = 0.0;
    vector<int> v(N);
    for(int i = 0; i < N; i++) v[i] = i + 1;
    do {
        for(int i = 0; i < N - 1; i++) sum += dist(v[i], v[i+1]);
    } while(next_permutation(v.begin(), v.end()));
    int Factorial = 1;
    for(int i = 2; i <= N; i++) Factorial *= i;
    cout << fixed << setprecision(10) << sum / Factorial << endl;
    return;
}

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


Measured memory_bytes: 4120
#include <stdio.h>

int main() {
  int A,B,C;
  int count=0;
  scanf("%d %d %d",&A,&B,&C);
  if (A+B >= C) {
    count = B+C;
  }
  if (A+B < C) {
    count = (A+B+1) + B;
  }
  printf("%d",count);
  return 0;
}


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

using namespace std ;
typedef long long ll;
typedef string str;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<int, int> pii;
typedef vector<pii> vpii ;

#define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++) 
#define FOR(i, a, b) for(ll (i) = a; (i) < (ll)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  vll num(n) ;
  set<ll> S ;
  REP(i,n){
    cin >> num[i] ;
    S.insert(num[i]) ;
  }
  if(SZ(S)>=4){
    no() ;
  }
  else{
    if(SZ(S)==1){
      auto itr = S.begin() ;
      ll a = (*itr) ;
      bool f = (ll)(a^a)==a ;
      if(f){
        yes() ;
      }
      else{
        no() ;
      }
    }
    else if(SZ(S)==2){
      auto itr = S.begin() ;
      ll a = (*itr) ;
      itr++ ;
      ll b = (*itr) ;
      int cnta = 0 ;
      int cntb = 0 ;
      REP(i,n){
        if(num[i]==a){
          cnta++ ;
        }
        else{
          cntb++ ;
        }
      }
      if(2*cnta==cntb && (ll)(a^b)==b){
        yes() ;
      }
      else{
        no() ;
      }
    }
    else{
      auto itr = S.begin() ;
      ll a = (*itr) ;
      itr++ ;
      ll b = (*itr) ;
      itr++ ;
      ll c = (*itr) ;
      if((ll)(a^b)!=c){
        no() ;
        return 0 ;
      }
      int cnta = 0 ;
      int cntb = 0 ;
      int cntc = 0 ;
      REP(i,n){
        if(num[i]==a){
          cnta++ ;
        }
        else if(num[i]==b){
          cntb++ ;
        }
        else if(num[i]==c){
          cntc++ ;
        }
      }
      if(max({cnta,cntb,cntc})==min({cnta,cntb,cntc})){
        yes() ;
      }
      else{
        no() ;
      }
    }
  }

  return 0 ;
}

Measured memory_bytes: 4480
#include <stdio.h>

int main(void){
	
	int a[3];		
	int i, tmp;
	scanf("%d %d %d", &a[0], &a[1], &a[2]);
	
	if(a[0] > a[2]){
		tmp = a[0];
		a[0] = a[2];
		a[2] = tmp;
	}
	
	for(i = 0; i < 2; i++){
		if(a[i] > a[i + 1]){
			tmp = a[i + 1];
			a[i + 1] = a[i];
			a[i] = tmp;
		}
	}	
		
	printf("%d %d %d\n", a[0], a[1], a[2]);
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> 	pii;
typedef long long 		ll;
typedef vector<int> 	vi;
typedef long double ld;
#define PI 				3.14159265
#define int				long long
#define f 				first
#define s 				second
#define pb 				push_back
#define mtup 			make_tuple
#define nl 				'\n'
#define FLASH 			ios_base::sync_with_stdio(false);cin.tie(NULL);
#define maxheap 		priority_queue<ll>
#define minheap 		priority_queue<ll,vector<ll> ,greater<ll>>
const ll inf = 1e18 + 1;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 55;
ll modpow(ll a,ll b,int mod = LLONG_MAX) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b) {return __gcd(a,b);}

signed main(){
	FLASH
	int r, d, x;
	cin >> r >> d >> x;
	for (int i = 1; i <= 10; i++){
		cout << r * x - d << nl;
		x = r * x - d;
	}
	return 0;
}


Measured memory_bytes: 256
a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def main(s,n,a):
    s = list(s)
    for i in range(len(s)):
        num = a.find(s[i])
        j = (num+n)%26
        s[i] = a[j]
    s = ''.join(s)
    return s

n = input()
n = int(n)
s = input()

print(main(s,n,a))


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

map<pair<int, int>, int> edge;

void dfs(int x, int y, vector<vector<int>> &data) {
  int a;
  if(y != -1) {
    a = edge[make_pair(min(x, y), max(x, y))];
  }
  else {
    a = 100010;
  }
  int pass = 0;
  for(int i = 0; i < data.at(x).size(); i++) {
    if(data.at(x).at(i) == y) {
      pass = 1;
      continue;
    }
    else {
      if(i + 1 - pass < a) {
        int c = min(x, data.at(x).at(i));
        int d = max(x, data.at(x).at(i));
        edge.at(make_pair(c, d)) = i + 1 - pass;
        dfs(data.at(x).at(i), x, data);
      }
      else {
        int c = min(x, data.at(x).at(i));
        int d = max(x, data.at(x).at(i));
        edge.at(make_pair(c, d)) = i + 2 - pass;
        dfs(data.at(x).at(i), x, data);
      }
    }
  }
}
        
int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> call(N - 1);
  vector<vector<int>> data(N);
  for(int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    data.at(a - 1).push_back(b - 1);
    data.at(b - 1).push_back(a - 1);
    edge[make_pair(a - 1, b - 1)] = 0;
    call.at(i) = make_pair(a - 1, b - 1); 
  }
  dfs(0, -1, data);
  int ans = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < data.at(i).size(); j++) {
      if(i < data.at(i).at(j)) {
        if(edge[make_pair(i, data.at(i).at(j))] > ans) {
          ans = edge[make_pair(i, data.at(i).at(j))];
        }
      }
    }
  }
  cout << ans << endl;
  for(int i = 0; i < N - 1; i++) {
    cout << edge[call.at(i)] << endl;
  }
}

Measured memory_bytes: 15872
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long k = sc.nextLong();
      	long l = 0;
      
      	if(a >= k){
          l = k;
        }else if (a < k && (a+b) >= k){
          l = a*1;
        }else {
          l = a*1 + (k-a-b)*(-1);
        }
      System.out.println(l);
    }
}

Measured memory_bytes: 35756
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()
A = LIST()[::-1]

if A[0] != 2:
	print(-1)
	exit()

N_min = 2
N_max = 3
for a in A[1:]:
	if ((N_min-1)//a) ==  N_max//a:
		print(-1)
		exit()

	N_min = -(-N_min//a)*a
	N_max = N_max//a*a + a - 1

print(N_min, N_max)


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

namespace ABC073A
{
    class Program
    {
        static void Main(string[] args)
        {
          //string n;

          //n = Console.ReadLine();

          // if (n[0] == '9' || n[1] == '9')
          //    Console.WriteLine("Yes");

          //else
          //   Console.WriteLine("No");

          //Console.ReadKey();






            int n;

            n = int.Parse(Console.ReadLine());

            if (n % 10 == 9 || n / 10 == 9)
                Console.WriteLine("Yes");

            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int nax = 2e5 + 5;
char sl[nax];

int main() {
	scanf("%s", sl);
	int n = strlen(sl);
	int answer = 0;
	int start = 0, end = n - 1;
	while(start < end) {
		if(sl[start] == sl[end]) {
			++start;
			--end;
			continue;
		}
		if(sl[start] == 'x') {
			++start;
			++answer;
			continue;
		}
		if(sl[end] == 'x') {
			--end;
			++answer;
			continue;
		}
		puts("-1");
		return 0;
	}
	printf("%d\n", answer);
	
	//~ vector<int> pos;
	//~ for(int i = 0; i < n; ++i)
		//~ if(sl[i] != 'x')
			//~ pos.push_back(i);
	//~ if(pos.empty()) {
		//~ puts("0");
		//~ return 0;
	//~ }
	//~ int start = 0, end = n - 1;
	//~ for(int i = 0; i < (int) (pos.size() + 1) / 2; ++i) {
		//~ int a = pos[i], b = pos[(int) pos.size() - 1 - i];
		//~ if(sl[a] != sl[b]) {
			//~ puts("-1");
			//~ return 0;
		//~ }
		//~ start = a;
		//~ end = b;
	//~ }
	
}


Measured memory_bytes: 384