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

using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();

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

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }
        template <typename T>
        void pvec(const T& vec, size_t sz) const {
            for (size_t i = 0; i < sz; i++)
                std::cout << vec[i] << (i == sz - 1 ? term : sep);
        }
        template <typename T>
        void pmat(const T& mat, size_t h, size_t w) {
            for (size_t i = 0; i < h; i++)
                for (size_t j = 0; j < w; j++)
                    std::cout << mat[i][j] << (j == w - 1 ? term : sep);
        }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    int x;
    cin >> x;
    prints()(1 - x);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    std::cin.tie(nullptr), std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    std::ifstream ifs("./in_out/input.txt");
    std::cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    std::ofstream ofs("./in_out/output.txt");
    std::cout.rdbuf(ofs.rdbuf());
#endif
    std::cout << std::setprecision(18) << std::fixed;
    solve();
    std::cout << std::flush;
    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
int main (void){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a*b>c*d){
        printf("%d\n",a*b);
    }else{
        printf("%d\n",c*d);
    }
    return 0;
}

Measured memory_bytes: 128
from math import gcd
from functools import lru_cache
from itertools import combinations

a = int(input())

def main():
    for i in range(1, a+1):
        for j in range(i, a+1):
            for k in range(j, a+1):
                x = len({i, j, k})
                if x == 1:
                    x = 1
                elif x == 2:
                    x = 3
                else:
                    x = 6
                yield gcd(gcd(i, j), k) * x

print(sum(main()))



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

int main(){
  int ans = 0;
  string S;
  cin >> S;
  int cnt0=0,cnt1=0;
  for(int i=0;i<S.size();i++){
    if(S[i]=='0')cnt0++;
    else cnt1++;
  }
  ans = min(cnt0,cnt1) * 2;
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
int main()
{
     ll n,W;
     cin>>n>>W;
     ll w[n+1],v[n+1];
     for(ll i=1;i<=n;i++)    cin>>w[i]>>v[i];
     ll dp[n+1][W+1];
     for(ll i=0;i<=n;i++)
     {
     	for(ll j=0;j<=W;j++)
     	{
     		if(i==0 || j==0)    dp[i][j] = 0;
     		else if(w[i]<=j)
     		{
     			dp[i][j] = max(v[i] + dp[i-1][j-w[i]] ,dp[i-1][j]);
     		}
     		else
     		{
     			dp[i][j] = dp[i-1][j];
     		}
     	}
     }
     cout<<dp[n][W];
}

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

int main() {
  ll a,b,x,y;
  cin >> a >> b >> x >> y;
  bool tak = false
  
  rep(i, 1000000000000000000){
    x -= b;
    if(x <= 0){
      tak = true;
      break;
    }
    
    a -= y;
    if(a <= 0){
      break;
    }
  }
  
  if(tak)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3632
N, M = [int(x) for x in input().split()]
H = [0]
H += [int(x) for x in input().split()]

X = []
for i in range(M):
    X += [[int(x) for x in input().split()]]

same = []
temp = [1] * (N+1)
ans = 0


for j in range(M):
    if H[X[j][0]] > H[X[j][1]]:
        temp[X[j][1]] = 0
    elif H[X[j][0]] < H[X[j][1]]:
        temp[X[j][0]] = 0
    else:
        same = same +  [X[j][0], X[j][1]]

same = set(same)
ans = temp.count(1) - 1

for i in same:
    if temp[i] == 1:
        ans -=1

print(ans)

Measured memory_bytes: 30424
N = int(input())
A = list(map(int, input().split()))
X = [0] * N
for i in range(N):
  X[0] += (-1) ** i * A[i]
print(X[0], end = " ")
for i in range(N - 1):
  X[i + 1] = X[i] * (-1) + 2 * A[i]
  print(X[i + 1], end = " ")


Measured memory_bytes: 86144
n = int(input())
max_XminusY = -float('inf')
min_XminusY =  float('inf')
max_XplusY  = -float('inf')
min_XplusY  =  float('inf')

for _ in range(n):
    x, y = map(int, input().split())
    max_XminusY = max(max_XminusY, x - y)
    min_XminusY = min(min_XminusY, x - y)
    max_XplusY  = max(max_XplusY, x + y)
    min_XplusY  = min(min_XplusY, x + y)

print(max(abs(max_XminusY - min_XminusY), abs(max_XplusY - min_XplusY)))

Measured memory_bytes: 74244
S = input()

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        t = S.find('C')
        if S[1:t].islower() and S[t+1:].islower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
    class Program {
        static void Main(string[] args) {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
            Console.Out.Flush();
        }
		public void Solve(ConsoleInput cin) {
			while(!cin.isEOF) {
				var cards = cin.ReadIntArray(3);
				var myPoint = cards[0] + cards[1];
				var remain = Enumerable.Range(1, 10).Except(cards);
				var res = remain.Count(i => i + myPoint <= 20) > 3;
				Console.WriteLine(res ? "YES" : "NO");
			}
		}

	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
		
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator = separator;
			this._stream = stream;
			inputStream = new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count != 0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i < tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i < N; ++i)
				ret[i] = Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek() == -1; }
		}
	}

}



Measured memory_bytes: 16608
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 Q = sc.nextInt();
        int[][] cnt = new int[N][N];
        for (int i = 0; i < M; i++) {
            int l = sc.nextInt() - 1;
            int r = sc.nextInt() - 1;
            cnt[l][r]++;
        }
        for (int i = N - 2; i >= 0; i--)
            for (int j = 0; j < N; j++)
                cnt[i][j] += cnt[i + 1][j];
        for (int i = 1; i < N; i++)
            for (int j = 0; j < N; j++)
                cnt[j][i] += cnt[j][i - 1];
        for (int i = 0; i < Q; i++) {
            int p = sc.nextInt() - 1;
            int q = sc.nextInt() - 1;
            System.out.println(cnt[p][q]);
        }
        sc.close();
    }
}

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

using namespace std;

int main() {
    int a, b;

    cin >> a >> b;
    int la = a + '0';
    int lb = b + '0';



    if(lb <= la){
        string s(a, (char)lb);
        cout << s << endl;
    }else {
        string s(b, (char)la);
        cout << s << endl;
    }

    return 0;
}


Measured memory_bytes: 3588
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;

typedef pair<ll, ll> P;

const int MOD = 1000000007;
const ll INF = 1LL << 60;


// LRUD
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
// const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
// const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    for (int i = 0; i < n; i++){
        cin >> l[i];
    }

    int ans = 0;
    int current = 0;
    if (current <= x) ans++;
    for (int i = 0; i < n; i++){
        current += l[i];
        if (current <= x) ans++;
    }

    cout << ans << endl;

    return 0;
}





















Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <math.h>
#include <deque>
#include <queue>
#include <map>
#include <iterator>
#include <set>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

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

	int a, b;
	cin >> a >> b;
	int ans = 6 - a - b;
	cout << ans << endl;
}

Measured memory_bytes: 256
fun main(arg: Array<String>) {
    val MAX = 100001
    val isPrime = Array(MAX) { true }
    isPrime[0] = false; isPrime[1] = false
    for (i in 2 until MAX) {
        if (!isPrime[i]) continue
        for (j in i * 2 until MAX step i) isPrime[j] = false
    }
    val a = IntArray(MAX)
    for (i in 0 until MAX) {
        if (i % 2 == 0) continue
        if (isPrime[i] && isPrime[(i + 1) / 2]) a[i] = 1
    }
    val s = IntArray(MAX + 1)
    for (i in 0 until MAX) s[i + 1] = s[i] + a[i]
    val Q = nextInt()
    val ans = IntArray(Q)
    repeat(Q) { q ->
        var (l, r) = listOfInt()
        ans[q] = s[r + 1] - s[l]
    }
    println(ans.joinToString("\n"))
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 58348
import java.util.*;

class Main{
    void solve(){
        Scanner sc = new Scanner(System.in);
        int i, b, st = 0;
        for ( i = 0; i < 3; i++ ){
            b = sc.nextInt();
            if ( b == 1 ) st += (1<<i);
        }
        if ( st >= 3 ) System.out.println("Open");
        else System.out.println("Close");
    }

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


Measured memory_bytes: 26352
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, m;
    std::cin >> n >> m;
    int s = 0;
    for (int i = 0; i < m; i++) {
        int a;
        std::cin >> a;
        if (s + a > n) {
            std::cout << -1 << std::endl;
            return 0;
        }
        s += a;
    }

    std::cout << n - s << std::endl;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> p(n),ip(n);
    rep(i,n) cin >> p[i];
    ip = p;
    sort(all(ip));
    if(ip == p) {
        cout << "YES" << endl;
        return 0;
    }
    rep(i,n-1) rep2(j,i+1,n) {
        vector<int> np(n);
        np = p;
        swap(np[i],np[j]);
        if(np == ip) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

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

using namespace std;

int main()
{
    int x;
    scanf("%d",&x);
    for(int i=2;i<x/2;i++)
    {
        if(x%i==0)
        {
            x++;
            i=1;
            continue;
        }

    }
    printf("%d",x);
    return 0;
}


Measured memory_bytes: 256
from collections import deque

n = int(input())
dq = deque()
for _ in range(n):
    query = input()
    if query == "deleteFirst":
        dq.popleft()
    elif query == "deleteLast":
        dq.pop()
    else:
        op, arg = query.split()
        if op == "insert":
            dq.appendleft(arg)
        else:
            tmp = deque()
            while dq:
                item = dq.popleft()
                if item == arg:
                    break
                else:
                    tmp.append(item)
            while tmp:
                dq.appendleft(tmp.pop())
print(*dq)



Measured memory_bytes: 69728
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>
#include <random>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define endl '\n'

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e6) + 17;

int n;
ll a[MAXN], s[MAXN], x[MAXN];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n)
        cin >> a[i + 1];

    return true;
}

void solve() {
    forn (i, n) {
        s[i + 1] = s[i] + a[i + 1];
        x[i + 1] = x[i] ^ a[i + 1];
    }

    ll ans = 0;

    for (int i = 1; i <= n; ++i) {
        int l = i, r = n;

        for (; l < r; ) {
            auto m = (l + r + 1) / 2;

            if (s[m] - s[i - 1] == (x[m] ^ x[i - 1]))
                l = m;
            else
                r = m - 1;
        }

        ans += r - i + 1;
    }

    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');

#ifdef SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 10112
AA,BB,n=map(int,input().split())
CC=[]

if n==1:
    L=[1]
    l = sum(i >= AA for i in L)
    ll = sum(i > BB for i in L)
    print(l-ll)
    
else:
    def sample_code():
        fct = factorize(n)
        for div in divisorize(fct):
            C=(num(div))
            CC.append(C)


    def divisorize(fct):
        b, e = fct.pop()  # base, exponent
        pre_div = divisorize(fct) if fct else [[]]
        suf_div = [[(b, k)] for k in range(e + 1)]
        return [pre + suf for pre in pre_div for suf in suf_div]
    def factorize(n):
        fct = []  # prime factor
        b, e = 2, 0  # base, exponent
        while b * b <= n:
            while n % b == 0:
                n = n // b
                e = e + 1
            if e > 0:
                fct.append((b, e))
            b, e = b + 1, 0
        if n > 1:
            fct.append((n, 1))
        return fct
    def num(fct):
        a = 1
        for base, exponent in fct:
            a = a * base**exponent
        return a
    if __name__ == '__main__':
        sample_code()
    CCC=sorted(CC)
    nnn = sum(i >= AA for i in CCC)
    NNN = sum(i > BB for i in CCC)
    print(nnn-NNN)


Measured memory_bytes: 5620
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
int n,m,k,dp[1010][3010],sum[20][1010],ans=1e9;
char s[20][1010];
int calc(int x1,int y1,int x2,int y2)
{
	return sum[x2][y2]-sum[x2][y1-1]-sum[x1-1][y2]+sum[x1-1][y1-1];
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1;i<=n;i++) scanf("%s",s[i]+1);
	for (int i=1;i<=n;i++)
	 for (int j=1;j<=m;j++) sum[i][j]=(s[i][j]=='1')+sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
	for (int i=0;i<=m;i++)
	 for (int zt=0;zt<(1<<n);zt++) dp[i][zt]=1e9;
	for (int x=0;x<(1<<n);x++)
	{
		int num=0;
		for (int j=0;j<=n-1;j++)
		{
			num++; int l=j;
			while (l+1<=n-1 && ((x>>(l+1))&1)==((x>>l)&1)) l++;
			j=l;
		}
		dp[0][x]=num-1;
	}
	for (int i=1;i<=m;i++)
	 for (int zt=0;zt<(1<<n);zt++)
	 {
	 	int pre=-1;
	 	for (int j=0;j<=n-1;j++)
	 	{
	 		int ll=j; 
	 		while (ll+1<=n-1 && ((zt>>(ll+1))&1)==((zt>>ll)&1)) ll++; 
	 		int down=j+1,up=ll+1;
	 		int l=0,r=i-1,lc=m+1;
	 		while (l<=r)
	 		{
	 			int mid=(l+r)>>1;
	 			if (calc(down,mid+1,up,i)<=k) {lc=min(lc,mid); r=mid-1;}else l=mid+1;
	 		}
	 		pre=max(pre,lc);
	 		j=ll;
	 	}
	 	if (pre!=m+1 && pre!=-1) dp[i][zt]=min(dp[i][zt],dp[pre][zt]+(i!=m));
	 }
	for (int i=0;i<(1<<n);i++) ans=min(ans,dp[m][i]);
	printf("%d\n",ans);
return 0;
}

Measured memory_bytes: 10880
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

const int MOD = 2000003;
const int LEN = 1000000;

int T[MOD];
int ans[LEN];

void initTable() {
	for (int i = 0; i < MOD; i++) T[i] = 0;
	for (int i = 0; i < LEN; i++) ans[i] = 0;
}

long long makeKey(char str[]) {
	int sum = 0, p = 1, tmp;
	for (int i = 0; i < strlen(str); i++) {
		if (str[i] == 'A') tmp = 1;
		else if (str[i] == 'C') tmp = 2;
		else if (str[i] == 'G') tmp = 3;
		else if (str[i] == 'T') tmp = 4;
		sum += p*tmp;
		p *= 5;
	}
	return sum;
}

int h1(long long key) {
	return key % MOD;
}

int h2(long long key) {
	return 1 + (key % (MOD - 1));
}

int h(long long key, int i) {
	return (h1(key)+i*h2(key)) % MOD;
}

void insertKey(char str[]) {
	int i = 0;
	long long key = makeKey(str);
	while (true) {
		int j = h(key, i);
		if (T[j] == 0) {
			T[j] = key;
			break;
		}
		else i++;
	}
}

int findKey(char str[]) {
	int i = 0;
	long long key = makeKey(str);
	while (true) {
		int j = h(key, i);
		if (T[j] == key)
			return j;
		else if (T[j] == 0 || i >= MOD)
			return -1;
		else
			i++;
	}
}

int main() {
	int n;
	char com[10], str[14];
	cin >> n;
	initTable();
	for (int i = 0; i < n; i++) {
		scanf("%s %s", com, str);
		if (com[0] == 'i') {
			insertKey(str);
		}
		else if (com[0] == 'f') {
			if(findKey(str) != -1)
				cout << "yes" << endl;
			else
				cout << "no" << endl;
		}
	}
}



Measured memory_bytes: 14896
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

class MainClass
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static long GCD(long a,long b)
    {
        if (a < b)
            GCD(b, a);
        while (b != 0)
        {
            long r=a % b;
            a = b;
            b = r;
        }
        return a;
    }
    public static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        var input = Reads();
        var n = input[0];
        var x = input[1];
        input = Reads();
        var xx = new long[n];
        xx[0]= Math.Abs(input[0] - x);
        for (int i = 1; i < n; i++)
        {
            xx[i] = Math.Abs(input[i] - x);
            xx[i]=GCD(xx[i - 1], xx[i]);
        }
        Console.WriteLine(xx[n-1]);
        Console.Out.Flush();
    }
}



Measured memory_bytes: 23648
H, W, A, B = map(int, input().split())
mod = 7 + 10**9

def Power(i, n):
    if n == 1:
        return i
    else:
        if n%2 == 0:
            return Power((i*i)%mod, n//2)
        else:
            return (Power((i*i)%mod, n//2) * i) % mod

NF = [1 for i in range(H+W+1)]
for i in range(2, H+W+1):
    NF[i] = (NF[i-1] * i) % mod

NFI = [1 for i in range(H+W+1)]
NFI[H+W] = Power(NF[-1], mod-2)
for i in reversed(range(1, H+W)):
    NFI[i] = (NFI[i+1] * (i+1)) % mod

Ans = 0
for w in range(B, W):
    upper = (NF[H-A+w-1] * NFI[w] * NFI[H-A-1]) % mod
    lower = (NF[W+A-w-2] * NFI[A-1] * NFI[W-w-1]) % mod
    Ans += upper * lower % mod
    Ans %= mod
print(Ans)

Measured memory_bytes: 18968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

int main(){
    int A, B;
    cin>>A>>B;
    rep(i, 100000){
      	int AA=i*0.08;
      	int BB=i*0.1;
      	//cout<<AA<<" "<<BB<<endl;
        if(AA==A&&BB==B){
          	//cout<<AA<<" "<<BB<<endl;
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
  	//cout<<A*0.1<<endl;
    return 0;
}

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

namespace E
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine(Run(args));
    }

    private static long Run(string[] args)
    {
      var s = ConsoleReader.String();
      var t = ConsoleReader.String();

      var td = t.Distinct();
      var sd = s.Distinct();
      if (!td.All(c => sd.Contains(c)))
      {
        return -1;
      }

      var map = sd.ToDictionary(c => c, c => new List<int>());
      for (int i = 0; i < s.Length; i++)
      {
        map[s[i]].Add(i);
      }

      var pos = -1;
      var ans = 0L;
      foreach (var c in t)
      {
        var indexList = map[c];
        var listIndex = indexList.BinarysSearch(i => i > pos);
        if (listIndex > -1)
        {
          // Console.WriteLine(c + " list:" + String.Join(",", indexList));
          // Console.WriteLine("BPos:" + pos);
          pos = indexList[listIndex];
          // Console.WriteLine("APos:" + pos);
        }
        else
        {
          ans += s.Length;
          pos = indexList.First();
        }
      }
      ans += pos + 1;

      return ans;
    }
  }

  public static class ListExtensions
  {
    /// <summary>
    /// 二分探索を行うListの拡張メソッド
    /// <param name="list">拡張対象</param>
    /// <param name="compFunction">比較関数</param>
    /// <return>探索結果のインデックス。マッチしない場合は-1を返す</return>
    /// </summary>
    public static int BinarysSearch<T>(this List<T> list, Func<T, bool> compFunction)
    {
      int left = -1;
      int right = list.Count;

      while (right - left > 1)
      {
        int mid = left + (right - left) / 2;
        if (compFunction(list[mid]))
        {
          right = mid;
        }
        else
        {
          left = mid;
        }
      }
      if (right >= list.Count)
      {
        return -1;
      }
      else
      {
        return right;
      }
    }
  }

  internal static class ConsoleReader
  {
    public static string String()
    {
      return Console.ReadLine();
    }

    public static int Int()
    {
      return int.Parse(Console.ReadLine());
    }

    public static int[] IntArray()
    {
      return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }

    public static long Long()
    {
      return long.Parse(Console.ReadLine());
    }

    public static long[] LongArray()
    {
      return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }

    public static double[] DoubleArray()
    {
      return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
    }
  }
}

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

int main()
{
	int h, w;
	cin >> h >> w;
	for (int i = -1; i <= w; i++)
		cout << '#';
	cout << '\n';

	for (; h > 0; h--)
	{
		string str;
		cin >> str;
		cout << '#' << str << '#' << endl;
	}

	for (int l = -1; l <= w; l++)
		cout << '#';
	cout << '\n';

	return (0);
}


Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
typedef pair<int,int> P;
int h,w,dist[1005][1005]={},ans=0,dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
char c[1005][1005]={};
queue<P> q;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w;
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      dist[i][j]=inf;
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin >> c[i][j];
      if(c[i][j]=='#') {
        dist[i][j]=0,q.push({i,j});
      }
    }
  }
  while(q.size()) {
    P p=q.front();
    q.pop();
    for(int i=0; i<4; i++) {
      for(int j=0; j<4; j++) {
        int nx=p.first+dx[i],ny=p.second+dy[i];
        if(0<=nx&&nx<h&&0<=ny&&ny<w) {
          if(dist[nx][ny]>dist[p.first][p.second]+1) {
            dist[nx][ny]=dist[p.first][p.second]+1;
            q.push({nx,ny});
          }
        }
      }
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      ans=max(ans,dist[i][j]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 13328
# coding: utf-8
import sys

# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
printout = sys.stdout.write
sprint = sys.stdout.flush
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
#import math
# from itertools import product, accumulate, combinations, product
#import bisect
# import numpy as np
# from copy import deepcopy
from collections import deque
# from decimal import Decimal
# from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 998244353


def intread():
    return int(sysread())
def mapline(t=int):
    return map(t, sysread().split())
def mapread(t=int):
    return map(t, read().split())

def dfs(c, to, seen, G = set()):
    seen.add(c)
    G.add(c)
    for n in to[c]:
        if not n in seen:
            dfs(n, to, G, seen)
    return G


def get_groups(to):
    G = []
    seen = set()
    for i in range(1, len(to)):
        if not i in seen:
            g = dfs(i, to, seen = seen, G = set())
            G.append(g)
    return G

def run():
    N, M = mapline()
    P = deque(list(mapline()))
    P.appendleft(-1)
    to = [[] for _ in range(N+1)]
    for _ in range(M):
        x,y= mapline()
        to[x].append(y)
        to[y].append(x)

    G = get_groups(to)
    ans = 0
    #print(G)
    for g in G:
        for k in g:
            if P[k] in g:
                ans += 1

    print(ans)


if __name__ == "__main__":
    run()


Measured memory_bytes: 109216
#include<stdio.h>
int main() {
	int n, k;
	int i, j=0;
	scanf("%d%d", &n, &k);
	for (i = 0;i < 100000000;i++) {
		j = j + 1;
			if (n / k == 0) {
				break;
			}
			else {
				n = n / k;
			}
	    }
	printf("%d", j);
	return 0;
}

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

using namespace std;
using LL = long long int;
const LL mod = 1000000007;

int N;
const int MAX_N = 10005;

int A[MAX_N];

int main() {

    cin >> N;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        while(A[i]%2 == 0) {
            ans++;
            A[i] /= 2;
        }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main()
{
    int MOD = 1000000007;
    int h, w;
    cin >> h >> w;

    vector<vector<char>> v(h, vector<char>(w));

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> v[i][j];
        }
    }

    vector<vector<int>> dp(h, vector<int>(w));

    dp[0][0] = 1;
    for (int i = 1; i < h; i++)
    {
        if (v[i][0] != '#' && dp[i - 1][0] != 0)
        {
            dp[i][0] = 1;
        }
    }
    for (int i = 1; i < w; i++)
    {
        if (v[0][i] != '#' && dp[0][i - 1] != 0)
        {
            dp[0][i] = 1;
        }
    }

    for (int i = 1; i < h; i++)
    {
        for (int j = 1; j < w; j++)
        {
            if (v[i][j] != '#')
            {
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
            }
        }
    }

    cout << dp[h - 1][w - 1] << endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    int ans = -1;
    int j = 0;
    rep(i, N) {
        j = a[j] - 1;
        if (j == 1) {
            ans = i + 1;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}


signed main()
{
	fio
	vector<int> b={100,101,102,103,104,105};
	inp(n)
	bool a[n+1]={0};
	a[0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j:b)
		{
			if(i-j>=0 && a[i-j])
				a[i]=1;
		}
	}
	cout<<a[n];
	printclock;
}

Measured memory_bytes: 384
#include<iostream>
#define ll long long
using namespace std;
ll pre[1000000+5];
ll find(ll i)
{
	if (i == pre[i])return i;
	return pre[i] = find(pre[i]);
}
void merge(ll x, ll y)
{
	ll fx = find(x), fy = find(y);
	if (fx != fy)pre[fx] = fy;
}
int main()
{
	ll n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		pre[i] = i;
	for (ll i = 0; i < m; i++)
	{
		ll a, b;
		cin >> a >> b;
		merge(a, b);
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (pre[i] == i)ans++;
	}
	cout << ans-1 << endl;
}


Measured memory_bytes: 4420
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <map>
using namespace std;
int main() {
	int N, M, n, m ,ans;
	cin >> N >> M;
	n = pow(2, M);
	m = (N - M) * 100 + M * 1900;
	cout << n*m;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int cnt[100001], even[100001], rest[100001];

int main(void) {
    int i, n, m;
    scanf("%d%d",&n,&m);
    REP (i,n) {
        int x;
        scanf("%d",&x);
        cnt[x]++;
    }
    REP (i,1,1e5) {
        even[i%m] += cnt[i]/2;
        rest[i%m] += cnt[i];
    }
    int ans = rest[0] / 2;
    REP (i,1,m-1) {
        int x;
        if (i != m-i) x = min(rest[i],rest[m-i]);
        else x = rest[i] / 2;
        ans += x;
        rest[i] -= x;
        rest[m-i] -= x;
    }
    REP (i,1,m-1) {
        ans += min(even[i],rest[i]/2);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1536
(defun app ()
    (let ((n (read))
        (a 0)
        (ans T))
        (dotimes (i n)
            (setq a (read))
            (if (zerop (rem a 2))
                (if (not (or (zerop (rem a 6)) (zerop (rem a 10))))
                (setq ans NIL))
            )
        )
        (if (eq ans T)
        (format t "APPROVED~%")
        (format t "DENIED~%"))
    )
)
(app)


Measured memory_bytes: 23512
x,n=map(int,input().split())
if n!=0:
    p=list(map(int,input().split()))
else:
    print(x)
    exit()

t=100000
ans=0
for i in range(102):
    if i in p:
        continue
    elif t>abs(i-x):
        t=abs(i-x)
        ans=i

print(ans)

Measured memory_bytes: 9216
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<functional>
using namespace std;

long long gcd(long long a,long long b){

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

	return a;
}

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

int main() {
	int N;
	std::cin>>N;

	double answer = 0;

	vector<long long> arr(N);
	for(int i = 0;i < N; i++) {
		std::cin>>arr[i];
	}

	for(int i = 1;i<=N;i+=2) {
		if(i==N) {
			answer += 1 / static_cast<double>(arr[i-1]);
		} else {
			long long divisor = gcd(arr[i-1],arr[i]);
			long long multiplier = lcm(arr[i-1],arr[i]);
			answer += (static_cast<double>(arr[i-1] + arr[i]) / divisor) / multiplier;
		}
	}

	std::cout<<1 / answer<<"\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n;
    cin>>n;
    int flag=0;
    if(n<1||n>91)flag=0;
    else{
        for(int i=1;i<=9;++i){
            for(int j=1;j<=9;++j){
                if(i*j==n)flag=1;
            }
        }
    }
    if(flag==1)cout<<"Yes";
    else cout<<"No";
    return 0;
}

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

public class Main
{
	public static void main(String[] ars)
	{
		Scanner sc = new Scanner(System.in);
		StringBuilder s = new StringBuilder();
		String x = sc.next();
		s.append(x);
		if(s.charAt(s.length()-1) == 's')
			s.append("es");
		else
			s.append("s");
		System.out.println(s);
	}
	
	
}


Measured memory_bytes: 35592
use proconio::{input, fastout};

fn get_amount(n: u64, m: u64) -> u64 { n / m * (n / m + 1) / 2 * m }

#[fastout]
fn main() {
    input! {
        n: u64,
    }
    println!("{}", get_amount(n, 1) - get_amount(n, 3) - get_amount(n, 5) + get_amount(n, 15));
}


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

/*-------------------Define Start-------------------*/
typedef bool BL;    					// 布尔类型
typedef char SB;    					// 有符号1字节,8位
typedef unsigned char UB;    			// 无符号1字节,8位
typedef short SW;    					// 有符号短整型,16位
typedef unsigned short UW;    			// 无符号短整型,16位
typedef long SDW;    					// 有符号整型,32位
typedef unsigned long UDW;   			// 无符号整型,32位
typedef long long SLL;    				// 有符号长整型,64位
typedef unsigned long long ULL;			// 无符号长整型,64位
typedef char CH;    					// 单个字符
typedef float R32;    					// 单精度浮点数
typedef double R64;    					// 双精度浮点数

#define Rep(i, n) for (register SDW i = 0; i < (n); ++i)
#define For(i, s, t) for (register SDW i = (s); i <= (t); ++i)
#define rFor(i, t, s) for (register SDW i = (t); i >= (s); --i)
#define foreach(i, c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define ms0(a) memset(a,0,sizeof(a))
#define msI(a) memset(a,0x7f,sizeof(a))
#define LOWBIT(x) ((x)&(-x))

#define MP make_pair
#define PB push_back
#define ft first
#define sd second

#define pr(x) cout << #x << " = " << x << "  "
#define prln(x) cout << #x << " = " << x << endl

const ULL mod = 1e9 + 7;				//常用模数(可根据题目需要修改)
const ULL inf = 0x7fffffff;				//用来表示无限大
const ULL infLL = 0x7fffffffffffffffLL;	//用来表示无限大
/*-------------------Define End-------------------*/

const UDW maxN = 1e6 + 7;
string S;

void input(){
	cin >> S;
}

void solve(){
	Rep(i, S.size()) {
		if(isalnum(S[i]) && !isdigit(S[i])) {
			S[i] = 'x';
		}
	}
}

void output(){
	cout << S << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

map<string, int> mp;
int n, max_en;
string s;

int main()
{
    cin>>n;
    REP(i,n) {
        cin>>s;
        mp[s]++;
        MAX(max_en, mp[s]);
    }
    auto itr = mp.begin();
    while (itr != mp.end()) {
        if (itr->second == max_en)
            cout<<itr->first<<endl;
        itr++;
    }

    return 0;
}


Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
void solve(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll res=max({a*c,a*d,b*c,b*d});
	cout<<res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

Measured memory_bytes: 3784
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll n,i;string a,b;cin>>n>>a>>b;
	for(i=0;i<n;i++) cout<<a[i]<<b[i];
}


Measured memory_bytes: 256
S=list(input())
S=S[:-2]
#print(S,len(S))

def isDouble(s):
  for i in range(len(s)//2):
    if s[i]!=s[i+len(s)//2]:
      return False
  else:
    #print(i,s[i],s[i+len(s)//2])
    return True

for i in reversed(range(0,len(S)+1,2)):
  #print(S[:i])
  if isDouble(S[:i]):
    print(i)
    break

Measured memory_bytes: 3060
#include <cstdio>

using namespace std;

int main()
{
  int b, r, g, c, s, t;

  while (scanf("%d%d%d%d%d%d", &b, &r, &g, &c, &s, &t), (b + r + g + c + s + t)){
    int coin = 100;

    coin -= (t - (s + (b * 5) + (r * 3))) * 3 + ((b * 5) + (r * 3)) * 2;
    coin += ((b + r) + (b * 5) + (r * 3)) * 15 + g * 7 + c * 2;
    printf("%d\n", coin);
  }

  return (0);
}

Measured memory_bytes: 1028
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_end().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let v: Vec<u8> = read_vec();
    let x = v[0];
    let y = v[1];
    if y < x * 2 {
        println!("No");
        return
    }
    let k = y - x * 2;
    if k % 2 == 0 && k / 2 <= x {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
char a1;
int ans,a,maxx;
int main()
{
    cin>>a;
    for(int i=0;i<a;i++)
    {
    	cin>>a1;
    	if(a1=='I')
    	ans++;
    	else ans--;
    	maxx=max(ans,maxx);
	}
	cout<<maxx<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// 型シノニム
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
// 定数
constexpr ll INF   = 1e16;
constexpr ll INM   = 114514;
constexpr ll MOD   = 1e9 + 7;
constexpr ld EPS   = 1e-12;
constexpr ll dx[4] = {1, 0, -1, 0};
constexpr ll dy[4] = {0, 1, 0, -1};
// 便利関数
void IOS() { ios::sync_with_stdio(false), cin.tie(0); }
template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll mod) {
	if (a > 0) return a % mod;
	if (a % mod == 0) return 0;
	ll x = -a / mod + 1;
	a += x * mod;
	return a % mod;
}
ll powm(ll a, ll b, ll m) {
	if (b == 0) {
		return 1;
	} else if (b % 2 == 0) {
		ll d = powm(a, b / 2, m);
		return (d * d) % m;
	} else {
		return (powm(a, b - 1, m) * a) % m;
	}
}

// 本体

struct edge {
	ll to, cost, time;
	bool operator<(const edge &e) {
		return (*this).time < e.time;
	}
};

constexpr ll MAXC = 50 * 52;
ll d[50][MAXC + 1];
typedef pair<ll, P> node;

int main() {
	IOS();
	int n;
	cin >> n;
	n = n % 10;
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
		dump("hon");
	}else if(n == 0 || n == 1 || n == 6 || n == 8) {
		dump("pon");
	}else {
		dump("bon");
	}
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int n;
  cin >> n;
  int a[n];
  int first,second;
  for(int i = 0;i<n;i++)
  {
      cin >> a[i];
      if(i == 0) first = a[i];
      else if(i == 1)
      {
          if(a[i] > first)
          {
              second = first;
              first = a[i];
          }
          else
          {
              second = a[i];
          }
      }
      else
      {
          if(a[i] > first)
          {
              second = first;
              first = a[i];
          }
          else if(a[i] > second) second = a[i];
      }
  }
  for(int i = 0;i<n;i++)
  {
      if(a[i] != first) cout << first << endl;
      else cout << second << endl;
  }
  return 0;
}



Measured memory_bytes: 2432
import java.util.Scanner;

public class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        long Y = sc.nextLong();
        if (Math.abs(X - Y) <= 1) {
            System.out.println("Brown");
        } else {
            System.out.println("Alice");
        }
    }
}


Measured memory_bytes: 23252
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
#define N 100005
#define M 4005
#define db double
#define ll long long
int n,m,Sum[2][M][M],ans;
char ch;
struct point{int x,y,c;}p[N];
int ask(int lx,int ly,int rx,int ry,int c)
{//cout<<lx<<" "<<ly<<" "<<rx<<" "<<ry<<"aa\n";
	//cout<<Sum[c][rx][ry]<<" "<<Sum[c][lx-1][ry]<<" "<<Sum[c][rx][ly-1]<<" "<<Sum[c][lx-1][ly-1]<<"\n";
	return Sum[c][rx][ry]-Sum[c][lx-1][ry]-Sum[c][rx][ly-1]+Sum[c][lx-1][ly-1];
}
int Solve(int x,int y)
{
	int res0=0,res1=0;
	int midx=x+m/2-1,midy=y+m/2-1;
	/*if(midx<=m)
	{
		if(midy<=m)
		{
			res0=ask(x,y,midx,midy,0)+ask(midx+1,midy+1,m,m,0)+ask(1,1,m/2,m/2,0)-ask(x,y,m/2,m/2,0);
			res1=ask(x,midy+1,midx,m,1)+ask(x,1,midx,y-1,1)+ask(midx+1,y,m,midy,1)+ask(1,y,x-1,midy,1);
		}
		else
		{
			
		}
	}
	else
	{
		if(midy<=m)
		{
		}
		else
		{
			
		}
	}*/
	res0=ask(x,y,midx,midy,0)+ask(midx+1,midy+1,x+m-1,y+m-1,0);
	res1=ask(midx+1,y,x+m-1,midy,1)+ask(x,midy+1,midx,y+m-1,1);
	//cout<<x<<" "<<y<<" "<<midx<<" "<<midy<<"\n"<<ask(x,y,midx,midy,0)<<"aaa\n";
	//cout<<Sum[0][x-1][midy]<<" "<<Sum[0][midx][y-1]<<"\n";
	//cout<<midx<<" "<<midy<<"\n";
	//cout<<res0<<" "<<res1<<"\n";
	return res0+res1;
}
int main()
{
	scanf("%d%d",&n,&m),m<<=1;
	for(int i=1;i<=n;i++) scanf("%d%d %c",&p[i].x,&p[i].y,&ch),p[i].c=(ch=='W');
	for(int i=1;i<=n;i++) Sum[p[i].c][p[i].x%m+1][p[i].y%m+1]++;
	for(int i=1;i<=m;i++)
		for(int j=1;j<=m;j++)
			for(int k=0;k<2;k++)
				Sum[k][i+m][j]=Sum[k][i][j+m]=Sum[k][i+m][j+m]=Sum[k][i][j];
	for(int i=1;i<=m*2;i++)
		for(int j=1;j<=m*2;j++)
			for(int k=0;k<2;k++)
			{
				//if(Sum[k][i][j]) cout<<k<<" "<<i<<" "<<j<<"\n";
				Sum[k][i][j]+=Sum[k][i-1][j]+Sum[k][i][j-1]-Sum[k][i-1][j-1];
			}
	for(int i=1;i<=m;i++)
		for(int j=1;j<=m;j++) ans=max(ans,Solve(i,j));
	//cout<<Sum[0][1000][1]<<"==\n";
	//cout<<Solve(1,2)<<"aa\n";
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 126720