akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] a = new int[]{sc.nextInt(),sc.nextInt(),sc.nextInt()};
    Arrays.sort(a);
    System.out.println(a[2]*10+a[1]+a[0]);
  }
}

Measured memory_bytes: 22740
import math


def main():
    n, x = map(int, input().split())
    x_lst = list(map(int, input().split()))
    x_lst.sort()

    if n == 1:
        minimum = abs(x_lst[0] - x)
    elif n == 2:
        minimum = abs(x_lst[1] - x_lst[0])
        lst = [abs(x_lst[1] - x), abs(x_lst[0] - x)]
        lst.sort()
        lst.reverse()
        for i in range(2):
            if minimum % lst[i] == 0:
                minimum = lst[i]
                break
    else:
        lst1 = []
        for i in range(n):
            if i != n - 1:
                lst1.append(abs(x_lst[i + 1] - x_lst[i]))

        minimum = math.gcd(lst1[0], lst1[1])
        for i in range(n - 1):
            if i != n - 2:
                minimum = min(minimum, math.gcd(lst1[i], lst1[i + 1]))

        lst2 = []
        for i in range(n):
            lst2.append(abs(x_lst[i] - x))

        lst2.sort()
        lst2.reverse()
        for i in range(n):
            if minimum % lst2[i] == 0:
                minimum = lst2[i]
                break

    print(minimum)


if __name__ == '__main__':
    main()

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

int main() {
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(i % 2 == 0){
            if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'){
                //
            }
            else {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'){
                //
            }
            else {
                cout << "No" << endl;
                return 0;
            }
        }

        

    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sca = new Scanner(System.in);
		int n = sca.nextInt();
		int m = sca.nextInt();
		int[] ai = new int[n];
		int sum = 0; // 総投票数
		for(int i = 0; i < n; i++) {
			ai[i] = sca.nextInt();
			sum += ai[i];
		}
		int select = 0;

		for(int i = 0; i < n; i++) {
			if(ai[i] >= sum*(1/(4.0*m))) {
				select++;
			}
		}
		if(select >= m) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		// 後始末
		sca.close();
	}
}

Measured memory_bytes: 21844
import Control.Applicative
import Data.List
import Control.Monad

reshape :: [Int] -> (Int, Int)
reshape xs = (head xs, product (tail xs))

saleResult :: [(Int, Int)] -> [(Int, Int)]
saleResult [] = []
saleResult (x:xs) =
  let ys = filter (\y -> fst y == fst x) xs
      sr = snd x + sum (map snd ys)
  in
      (fst x, sr) : saleResult (xs \\ ys)


solver :: [[Int]] -> [Int]
solver xs =
  let ys = map reshape xs
      cand = saleResult ys
  in map fst $ filter (\c -> snd c >= 1000000) cand

main :: IO()
main = do
  n <- (read :: String -> Int) <$> getLine
  unless (n == 0) $ do
    inputs <- map (map (read :: String -> Int) . words) <$> replicateM n getLine
    let cand = solver inputs
    if null cand
      then putStrLn "NA"
      else mapM_ print cand
    main

Measured memory_bytes: 5460
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <cassert>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

string S;
bool check(int idx1, int idx2) {
    int cnt = 0;
    REP(i, idx1, idx2) {
        if (S[i] == '#') cnt++;
        else cnt = 0;

        if (cnt >= 2) return false;
    }
    return true;
}

int N;
bool check2(int A, int B, int C, int D) {
    if (!check(A, C) || !check(B, D)) return false;

    while (true) {
        if (A + 2 <= C && S[A + 2] == '.' && A + 2 != B) {
            A += 2;
        } else if (A + 1 <= C && S[A + 1] == '.' && A + 1 != B) {
            A += 1;
        } else if (B + 1 <= D && S[B + 1] == '.') {
            B += 1;
        } else if (B + 2 <= D && S[B + 2] == '.') {
            B += 2;
        } else return false;

        if (A > B) return true;
    }
}

signed main() {
    int A, B, C, D;
    cin >> N >> A >> B >> C >> D >> S;
    A--; B--; C--; D--;

    string yes = "Yes";
    string no = "No";

    if ((A < B && B < C && C < D)
        || (A < C && C < B && B < D)) {
        if (check(A, C) && check(B, D)) {
            cout << yes << endl;
        } else {
            cout << no << endl;
        }
    } else if (A < B && B < D && D < C) {
        if (check2(A, B, C, D)) {
            cout << yes << endl;
        } else {
            cout << no << endl;
        }
    } else assert(false);

    return 0;
}


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

using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int a, b;
  cin >> a >> b;

  if (a + b == 15){
    cout << "+";
    return 0;
  } else if (a * b == 15) {
    cout << "*";
    return 0;
  }
  cout << "x";
  return 0;
}


Measured memory_bytes: 256
n=int(input())
for i in range(n):
    gx,gy=map(int,input().split())
    L1=[[0 for y in range(16)]for x in range(16)]#縦
    L2=[[0 for y in range(16)]for x in range(16)]#横
    L3=[[0 for y in range(16)]for x in range(16)]#格子

    matatabi=int(input())
    for i in range(matatabi):
        x1,y1,x2,y2=map(int,input().split())
        if x1==x2:
            L1[max(y1,y2)][x1]=1
        else:
            L2[y1][max(x1,x2)]=1

    for y in range(gy+1):
        for x in range (gx+1):
            if x==y==0:
                L3[y][x]=1
            elif L1[y][x]==L2[y][x]==1:
                L3[y][x]=0
            elif (L1[y][x]==1 or L2[y][x]==1) and (y==0 or x==0):
                L3[y][x]=0
            elif y==0 or L1[y][x]==1:
                L3[y][x]=L3[y][x-1]
            elif x==0 or L2[y][x]==1:
                L3[y][x]=L3[y-1][x]
            else:
                L3[y][x]=L3[y][x-1]+L3[y-1][x]

    n=L3[gy][gx]
    if n==0:
        print("Miserable Hokusai!")
    else:
        print(n)


Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;



int main(){
    LL k,a,b;cin >> k >> a >> b;
    LL ans=1;
    if(b-a>=2){
        if(k>=a-1) ans+=a-1;k-=a-1;
        LL t=k/2;
        ans+=t*(b-a)+k%2;
    }
    else ans+=k;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
N,A = map(int,input().split())
X = list(map(int,input().split()))
for i in range(N):
    X[i] -= A
dp = [[0 for i in range(5001)] for i in range(N+1)]
dp[0][2500] = 1
u = 2500
d = 2500
for i in range(1,N+1):
    x = X[i-1]
    if x <= 0:
        d += x
    else:
        u += x
    for j in range(d,u+1):
        dp[i][j] += dp[i-1][j-x] + dp[i-1][j]
print(dp[N][2500]-1)

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

int main() {
int x,y,a,b,c,d,p;
cin >> a;
cin >> b;
cin>>c;
cin>>d;
cin>>p;
x=a*p;
if(p<=c){y=b;}
else{y=b+p*d-c*d;}
if(x<=y){cout<<x<<endl;}
else{cout<<y<<endl;}
	return 0;
}

Measured memory_bytes: 1160
import heapq
h = []
while True:
    cmd = input().split()
    if cmd[0] == "insert":
        num = int(cmd[1]) * (-1)
        heapq.heappush(h, num)
    elif cmd[0] == "extract":
        num=heapq.heappop(h) * (-1)
        print(num)
    else:
        break


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

int main() {
    int n;
    cin >> n;
    int a, ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if ((i+1)%2==1 && a%2==1)
            ans++;
    }
    cout << ans << endl;
}

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

int main() {
    ll N,M,t,r;
    cin >> N >> M;
    
    t = M-N*2;
    if(t >= 0)
        r = t/4 + N;
    else
        r = M/2;

    cout << r << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
string a,b="CF";
int al,bl;
int main()
{
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
    {
        if(a[i]==b[bl])
        {
            bl++;
            if(bl==2) break;
        }
    }
    if(bl==2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char S[101];
    int n;
    int flg = 1;
    int i=0;
    scanf("%s",S);
    n = (unsigned)(sizeof(S)/sizeof(S[0]));
    //printf("%d",n);
    while(S[i]!=NULL){
    //for(int i=0; i<n; i++){
        if(i%2 ==0){
            if(S[i]!='R' && S[i]!='U' && S[i]!='D')flg = 0;
        }else if(i%2 ==1){
            if(S[i]!='L' && S[i]!='U' && S[i]!='D')flg = 0;
        }
        i++;
    }
    if(flg==1){
        printf("Yes");
    }else{
        printf("No");
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
  int N; cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  for (int i=0; i<N; i++) cin >> P[i];
  for (int i=0; i<N; i++) cin >> Q[i];
  
  if (P>Q){
    swap(P, Q);
  }
 
  int ans = 0;
  while (P < Q && ++ans){
    next_permutation(P.begin(), P.end());
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;
ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

ll N, K;
ll ret;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> N; vector<int> A(N + 1, 0), B(N, 0);
    for(int i = 0; i < N + 1; i++) cin >> A[i];
    for(int i = 0; i < N; i++) cin >> B[i];
    
    for(int i = 0; i < N; i++)
    {
        auto remove = min(A[i], B[i]);
        A[i] -= remove; B[i] -= remove;
        auto bonus = min(A[i+1], B[i]);
        A[i+1] -= bonus;
        ret += remove + bonus;
    }
    cout << ret << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const long long MAXS = 114514;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
queue<string> Q;

void get(){
    while(true){
        string s=Q.front();
        if(s.size()>=10){
            break;
        }
        Q.pop();
        Q.push(s+'3');
        Q.push(s+'5');
        Q.push(s+'7');
        Q.push(s);
    }
} 

signed main(){
    long long n;
    cin>>n;
    Q.push("");
    get();
    set<long long> num;
    while(!Q.empty()){
        string s = Q.front();
        Q.pop();
        bool a = false;
        bool b = false;
        bool c = false;
        for(int i=0;i<s.size();i++){
            if(s[i]=='3')a=true;
            if(s[i]=='5')b=true;
            if(s[i]=='7')c=true;
        }
        if(a&&b&&c){
            long long k = stoll(s);
            if(k<=n)num.insert(k);
        }
    }
    cout<<num.size()<<endl;
}

Measured memory_bytes: 61076
#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 998244353ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
int main() {
	doin();
	int n, m, h, w;
	cin >> n >> m;
	cin >> h >> w;
	ll ans = h*m + w*n - h*w;
	ans = n*m - ans;
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			m = scanner.nextInt();
			n = scanner.nextInt();
			if ((m | n) == 0)
				break;
			M = new HashMap<Integer, Integer>();
			h = 1;
			a = new int[n][m];
			Y = new int[24];
			X = new int[24];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < m; j++) {
					int t = scanner.nextInt();
					if (t == 0) {
						a[i][j] = -1;
					} else if (t == 1) {
						Y[h] = i;
						X[h] = j;
						a[i][j] = h++;
					} else {
						Y[0] = i;
						X[0] = j;
						a[i][j] = 0;
					}
				}
			System.out.println(slove(0, 1));
		}
	}

	private int slove(int cur, int mask) {
		int k = cur << 24 | mask;
		if (M.containsKey(k))
			return M.get(k);
		int res = 0;
		for (int[] mo : move) {
			int y = Y[cur];
			int x = X[cur];
			while (true) {
				y += mo[0];
				x += mo[1];
				if (!isOK(y, x))
					break;
				if (a[y][x] == 0)
					if (mask == (1 << h) - 1)
						res++;
				if (a[y][x] >= 1) {
					if ((mask >> a[y][x] & 1) == 1)
						continue;
					res += slove(a[y][x], mask | 1 << a[y][x]);
					break;
				}
			}
		}
		M.put(cur << 24 | mask, res);
		return res;
	}

	private boolean isOK(int y, int x) {
		if (0 <= y && y < n && 0 <= x && x < m)
			return true;
		return false;
	}

	int m, n, h;
	int[] Y, X;
	int[][] a;
	int[][] move = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
	Map<Integer, Integer> M;
}

Measured memory_bytes: 178392
n, x, y = map(int, input().split())
ans = [0]*(n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        res = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(x-j)+1+abs(y-i))
        ans[res-1] += 1
for i in ans: print(i)

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

int main(void)
{
	char str_t[201], tmp[101], str_p[101];

	scanf("%s", str_t);
	scanf("%s", str_p);
	strcpy(tmp, str_t);
	strcat(str_t, tmp);

	if(strstr(str_t, str_p)){
		printf("Yes\n");
	} 
	else {
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 2760
#include<stdio.h>
#include<string.h>
int A[200];
int solve ( int N, int i, int m ) {
    int ans;
    if ( m == 0 ) return 1;
    if ( i >= N ) return 0;
    ans = solve( N, i + 1, m ) || solve( N, i + 1, m - A[i] );
    return ans;
}
int main(void){
    int n, q, M[2000], i, j;
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
    scanf("%d", &q);
    for ( i = 0; i < q; i++ ) scanf("%d", &M[i]);
    for ( i = 0; i < q; i++ ) {
        if( solve( n, 0, M[i]) ) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}

Measured memory_bytes: 1792
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=5e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const double PI = acos(-1);

void solve(){
    int n;
    cin>>n;
    int res=1,mx=0;
    loop(n+1,i,2){
        int tmp=i;
        int cnt=0;
        while(tmp%2==0)
            cnt++,tmp/=2;
        if(cnt>mx)
            res=i,mx=cnt;
    }
    cout<<res<<Endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

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

typedef long long LL;
typedef vector<int> VI;

int main() {
  int H, A;
  cin >> H >> A;
  if (H % A == 0) {
    cout << H/A << endl;
  } else {
    cout << H/A + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define endl '\n'
#define PI 3.1415926535897932385
#define MOD 1000000007
typedef vector<ll> ve;

 ll pow(ll b,ll p,ll m)
{
    ll r=1;
    while(p>0)
    {
        if(p%2==1)
        {
            r=(r*b)%m;
        }
        b=(b*b)%m;
        p=p>>=1;
     }
    return r;
}


int main()
{ 
	ll n;
	cin>>n;
	cout<<fixed<<setprecision(2)<<2*PI*n<<endl;
	 return 0;

}    
	 		
	    

Measured memory_bytes: 3776
import bisect
n = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))

BC = []
for b in B:
    BC.append(n - bisect.bisect_right(C, b))

cumsum = [BC[-1]]
for bc in BC[-2::-1]:
    cumsum.append(cumsum[-1] + bc)
cumsum = cumsum[::-1]

ans = 0
for a in A:
    idx = bisect.bisect_right(B, a)
    if idx < n: ans += cumsum[idx]
print(ans)


Measured memory_bytes: 114020
#include<iostream>
#include<algorithm>
using namespace std;
int Gcd(int a, int b) {
	int gcd;
	int c = max(a, b);
	int d = min(a, b);
	while (true) {
		if (c % d == 0) {
			gcd = d;
			goto C;
		}
		else {
			c -= d;
			if (c <= d) {
				swap(c, d);
			}
		}
	}
C:
	return gcd;
}
int main() {
	int x, y; cin >> x >> y;
	int gcd = Gcd(x, y);
	cout << ((x / gcd) + (y / gcd) - 1) * gcd + 1 << endl;
	char c; cin >> c;
}

Measured memory_bytes: 3112
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int m, d, ans = 0;
	cin >> m >> d;
	for (int i = 1; i <= m; i++)
		for (int j = 1; j <= d; j++)
			ans += ((j / 10 >= 2) && (j % 10 >= 2) && (j / 10) * (j % 10) == i);
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
g1 = ["1", "3", "5", "7", "8", "10", "12"]
g2 = ["4", "6", "9", "11"]
x, y = input().split()
if x in g1 and y in g1 or x in g2 and y in g2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

class Point {
 public:
  double x, y;

  Point(double x = 0, double y = 0): x(x), y(y) {}

  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }

  double abs() { return sqrt(norm()); }
  double norm() {return x * x + y * y; }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }

};

typedef Point Vector;

double dot(Vector a, Vector b) {
  return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
  return a.x * b.y - a.y * b.x;
}

struct Segment {
  Point p1, p2;
};

typedef Segment Line;

Point project(Segment s, Point p) {
  Vector base = s.p2 - s.p1;
  double r = dot(p - s.p1, base) / base.norm();
  return s.p1 + base * r;
}

Point reflect(Segment s, Point p) {
  return p + (project(s, p) - p) * 2.0;
}

int main() {
  Segment s;
  cin >> s.p1.x >> s.p1.y >> s.p2.x >> s.p2.y;
  int n;
  cin >> n;
  cout << fixed;
  for (int i = 0; i < n; i++) {
    Point p;
    cin >> p.x >> p.y;
    Point reflected_p = reflect(s, p);
    cout << setprecision(10) << reflected_p.x << " " << reflected_p.y << endl;
  }
}



Measured memory_bytes: 3292
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
int inf = 1e9;

int main() {
  int n, k; cin >> n >> k;
  string s; cin >> s;
  s += " ";
  vector<int> b(n+1, 0);
  for(int i=1; i<n; i++) {
    b[i] = b[i-1];
    if(s[i-1] != s[i]) {
      b[i]++;
    }
  }
  // for(int i=0; i<n; i++) cerr << b[i] << " ";
  // cerr << endl;

  int r = 0;
  int cnt = 0;
  for(int l=0; l<n; l++) {
    while(true){
      if(s[l] == '1' && !(b[r]-b[l] <= 2*k && r < n)) {
        break;
      }
      if(s[l] == '0' && !(b[r]-b[l] <= 2*k-1 && r < n)) {
        break;
      }
      r++;
      cnt = max(cnt, r-l);
    }
    cnt = max(cnt, r-l);
  }
  cout << cnt << endl;
  return 0;
}


//EOF


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define int long long
//typedef long long ll;
#define sqr(x) ((x)*(x))
#define pb push_back 
const int N=1000002,M=998244353;
int pw(int x,int y){int z=1;for(;y;y>>=1,x=1ll*x*x%M)if(y&1)z=1ll*z*x%M;return z;}
void inc(int &x,int y){x+=y;if(x>=M)x-=M;}void dec(int &x,int y){x-=y;if(x<0)x+=M;}
void Max(int &x,int y){if(y>x)x=y;}void Min(int &x,int y){if(y<x)x=y;}
//struct node{int to,ne;}e[];
//void add(int x,int y){e[++tot]=(node){y,h[x]},h[x]=tot;}
int k,l,p,i,ll,pp,j;
char s[100000],ss[100000];
int cal(char *ss){
	int cnt=0;
	for (int i=1;i<ll;i++)
		if (ss[i]==ss[i-1]){
			cnt++,ss[i]=0;
		}
	return cnt;
}
signed main(){
	scanf("%s%lld",s,&k),l=strlen(s);
	if (k>100){
		for (i=0;i<(98+k%2);i++)
			for (j=0;j<l;j++) ss[i*l+j]=s[j];
		ll=l*(98+k%2),p=cal(ss);
		for (i=0;i<(100+k%2);i++)
			for (j=0;j<l;j++) ss[i*l+j]=s[j];
		ll=l*(100+k%2),pp=cal(ss);
		printf("%lld",p+(pp-p)*((k-98-k%2)/2));
	}else{
		for (i=0;i<k;i++)
			for (j=0;j<l;j++) ss[i*l+j]=s[j];
		ll=l*k,p=cal(ss);
		printf("%lld",p);
	}
}
/*
aaa
1000
*/


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, m, u, v, s, t;
vector<int> vec[300010];
int dist[300010];
signed main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> u >> v;
		vec[u * 3].push_back(v * 3 + 1);
		vec[u * 3 + 1].push_back(v * 3 + 2);
		vec[u * 3 + 2].push_back(v * 3);
	}
	cin >> s >> t;
	queue<P> que;
	que.push(make_pair(s * 3, 0));
	fill(dist + 3, dist + (n + 1) * 3, INF);
	dist[s * 3] = 0;
	while (!que.empty()) {
		P p = que.front();
		que.pop();
		for (int i : vec[p.first]) {
			if (dist[i] == INF) {
				dist[i] = p.second + 1;
				que.push(make_pair(i, p.second + 1));
			}
		}
	}
	if (dist[t * 3] == INF)cout << -1 << endl;
	else cout << dist[t * 3] / 3 << endl;
	return 0;
}

Measured memory_bytes: 18944
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

double N; cin >> N;

rep(i, 1, 50001){
    if ((int)(i * 1.08) == N) {
        cout << i << endl;
        return 0;
    }
}
cout << ":(\n";


}

// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];

  std::sort(a.begin(), a.end(), std::greater<int>());

  int sum = 0;
  rep(i, N) {
    if (i % 2 == 0) sum += a[i];
    else sum -= a[i];
  }

  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete

f 1 = 6000
f 2 = 4000
f 3 = 3000
f 4 = 2000

main = map (uncurry (*) . fmap f . swap . apply2 (,)) <$> replicateM 4 getInts >>= mapM_ print
    
    


Measured memory_bytes: 3648
n = int(input())
a = list(map(int, input().split()))
l = {}
c = {}
for i in range(n):
  try:
    l[a[i]] += 1
  except:
    l[a[i]] = 1

for k,v in l.items():
  c[k] = v*(v-1)/2

sum_val = sum(c.values())

for j in a:
  v = l[j] - 1
  print(int(sum_val - c[j] + v*(v-1)/2))


Measured memory_bytes: 95180
#include<stdio.h>
#include<string.h>
 
int main(){
  int K;
  while(scanf("%d",&K)==0);
  char S[150];
  while(scanf("%s",S)==0);
  int l=strlen(S);
  char a[]="...";
  char T[150];
  
  int i;
  for(i=0;i<K;i++){
   T[i]=S[i];
  }
  
  T[K]='\0';
  
  if(l<=K){
    printf("%s\n",S);
  }else if(l>K){
    printf("%s%s\n",T,a);
  }
  
  
  
  return 0;
}

Measured memory_bytes: 1728
// inputに入力データ全体が入る
function Main(input) {
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
	var c = a*b;
  	if (c % 2 === 1) {
      console.log('Odd');
    } else {
      console.log('Even');
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	D := 60

	N := sc.i()
	K := sc.i()
	A := make([][]int, D)
	A[0] = make([]int, N+1)
	for i := 1; i <= N; i++ {
		A[0][i] = sc.i()
	}

	for i := 1; i < D; i++ {
		A[i] = make([]int, N+1)
		for j := 1; j <= N; j++ {
			A[i][j] = A[i-1][A[i-1][j]]
		}

	}

	p := 1
	for i := D; i >= 0; i-- {
		if K&(1<<i) != 0 {
			p = A[i][p]
		}
	}

	fmt.Println(p)

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


Measured memory_bytes: 100300
#include <bits/stdc++.h>
#define int long long int
#define double long double
#define mod 1000000007
#define w(t) \
   int t;    \
   cin >> t; \
   while (t--)
#define f(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define pob pop_back
#define mk make_pair
#define ARMY  ios_base::sync_with_stdio(false);  cin.tie(NULL);         cout.tie(NULL);
using namespace std;
int32_t main()
{
   ARMY

 string s;
  cin>>s;
  cout<<s;
  if(s[s.size()-1]=='s')
    cout<<"es";
  else cout<<"s";
  return 0;
 
 

}

Measured memory_bytes: 3648
#include <stdio.h>

#define MAX_N 52
#define MAX_M 52

int main(void) {
	char board[MAX_M][MAX_N] = {{0}};
	unsigned short m, n, x, y;
	unsigned int i, j, k;

	scanf("%hu%hu", &m, &n);
	for(i = 0; i < m; i++) {
		scanf("%s%*c", board[i]);
	}

    for(i=0;i<m;i++) for(j=0;j<n;j++) if(board[i][j]=='.') board[i][j]='0';

	for(i = 0; i < m; i++) {
		for(j = 0; j < n; j++) {
			if(board[i][j] == '#') continue;
			if(i != 0 && j != 0 && board[i - 1][j - 1] == '#') board[i][j]++;
			if(i != 0 && board[i - 1][j] == '#') board[i][j]++;
			if(i != 0 && j != n - 1 && board[i - 1][j + 1] == '#') board[i][j]++;

			if(j != 0 && board[i][j - 1] == '#') board[i][j]++;
			if(j != n - 1 && board[i][j + 1] == '#') board[i][j]++;

			if(i != m - 1 && j != 0 && board[i + 1][j - 1] == '#') board[i][j]++;
			if(i != m - 1 && board[i + 1][j] == '#') board[i][j]++;
			if(i != m - 1 && j != n - 1 && board[i + 1][j + 1] == '#') board[i][j]++;
		}
	}

	for(i = 0; i < m; i++)
        puts(board[i]);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll pt1, pt2;
string s1, s2;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s1;
	s2="AKIHABARA";
	ll n = s2.size();
	while(pt1 < n && pt2 < n){
		if(s1[pt1]==s2[pt2]){
			pt1++;
			pt2++;
		}
		else{
			if(s2[pt2]=='A'){
				pt2++;
			}
			else{
				cout << "NO\n";
				return 0;
			}
		}
	}
	if(pt1!=s1.size() || pt2!=n){
		cout << "NO\n";
	}
	else{
		cout <<"YES\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
long int gcd(long int a, long int b){
  if(a<b){
    long int tmp = a;
    a = b;
    b = tmp;
  }
  long int r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  long int gcd = b;
  return gcd;
}

int main(){
  long int N,M;
  string S,T;
  cin >> N >> M >> S >> T;
  if(N != 1 && M != 1){
  long int cd = gcd(N, M);
  if(cd == 1){
    if(S[0]==T[0])  cout << N*M << endl;
    else cout << -1 << endl;
  }else{
    bool moji = true;
    long int n = N / cd;
    long int m = M / cd;
    for(long int i = 0;i < cd;i++){
      if(S[i*n] != T[i*m]) moji = false;
    }
    if(moji == true) cout << m*N << endl;
    else cout << -1 << endl;
  }
  }else if(N == 1){
     bool moji = true;
    for(long int i = 0;i < M;i++){
     if(S[0] != T[i]) moji = false;
    }
    if(moji == true) cout << M << endl;
    else cout << -1 << endl;
  }else if(M == 1){
    bool moji = true;
    for(long int i = 0;i < N;i++){
     if(T[0] != S[i]) moji = false;
    }
    if(moji == true) cout << N << endl;
    else cout << -1 << endl;
  }
    
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>

using namespace std;
const int N=2e5+10,inf=1e9;
int dp[N][2];
char s[N];

int main(){
    int r,D,x,ans;
	cin >> r >> D >> x;
    for(int i=0;i<10;i++){
        x = r*x - D;
        cout << x << endl;
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;

ll binary_search(function<bool(ll)> func, ll start, ll end) {
    /*      func:int ->bool
            returns smallest int x where func(x) evaluates to true, searches in [start,end), it is assumed the values are false, .. , false, true ...
             */
    if (end <= start) {   return end;  }   // has to be here, otherwise func(end-1) in next line could be a problem
    if (!func(end-1)) {  return end;  }
    while (end-start>1) {
        ll mid = (start+end)/2;
        if (func(mid)) {  end = mid;  } else { start = mid;   }
    }
    if (func(start)) {  return start;  } else {  return end;   }
};


template<class T>
T fastpower(T a, long long n) {  // n must be >= 1
  if (n==0) {return 1;}
  if (n % 2 == 0) {  
      T halfpower = fastpower<T>(a, n/2);
      return (halfpower*halfpower) % modd;
  } else {
      if (n == 1) {  return a; } else {  
          T halfpower = fastpower<T>(a, n/2);
          return (((halfpower*halfpower)%modd)*a)%modd;
      }
  }
};


int how_many_below(vector<ll>& a, ll y) {
   return (lower_bound(a.begin(), a.end(), y) - a.begin());
}

int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(a); readint(b);
        int c = (a+b)/2;
        if (abs(c-a)==abs(b-c)) {
            cout << c << endl;
        } else {
            cout << "IMPOSSIBLE" << endl;
        }
    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <bitset>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

const int MAXN = 3005;

int n;

ll MOD,ans;
ll sum[MAXN];
ll pw2[MAXN * MAXN];
ll C[MAXN][MAXN];
ll S[MAXN][MAXN];

ll power(ll a,ll b,ll p)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			(res *= a) %= p;
		(a *= a) %= p;
		b >>= 1;
	}
	return res;
}

int main()
{
	scanf("%d%lld",&n,&MOD);
	for (int i = 0;i <= n;i++)
	{
		C[i][0] = S[i][0] = 1;
		for (int j = 1;j <= i;j++)
		{
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
			S[i][j] = (S[i - 1][j - 1] + S[i - 1][j] * (j + 1)) % MOD;
		}
	}
	pw2[0] = 1;
	for (int i = 1;i <= n * n;i++)
		pw2[i] = (pw2[i - 1] << 1) % MOD;
	for (int i = 0;i <= n;i++)
	{
		ll tot = 0;
		for (int j = 0;j <= i;j++)
			(tot += S[i][j] * pw2[(n - i) * j]) %= MOD;
		if (i & 1)
			(ans -= C[n][i] * power(2,power(2,n - i,MOD - 1),MOD) % MOD * tot) %= MOD;
		else
			(ans += C[n][i] * power(2,power(2,n - i,MOD - 1),MOD) % MOD * tot) %= MOD;
	}
	printf("%lld\n",(ans + MOD) % MOD);
	return 0;
}

Measured memory_bytes: 210048
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  rep(i,0,50)rep(j,0,100)dp[i][j] = 1;
  rep(i,50,100)rep(j,0,100)dp[i][j] = 0;
  cin >> n >> m;
  cout << 100 << " " << 100 << endl;
  ll x,y;
  x = y = 0;
  n--,m--;
  while(n){
    dp[x][y] = 0;
    if(y+2 < 100)y += 2;
    else x += 2,y = 0;
    n--;
  }
  x = 51,y = 0;
  while(m){
    dp[x][y] = 1;
    if(y+2 < 100)y += 2;
    else x += 2,y = 0;
    m--;
  }
  rep(i,0,100){
    rep(j,0,100){
      if(dp[i][j])cout << '#';
      else cout << '.';
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();
	int C = scan.nextInt();

	int first, second, third;
	
	if(A >= B){
	    if(A >= C){
		first = A;
		if(C >= B){
		    second = C;
		    third = B;
		}else{
		    second = B;
		    third = C;
		}
	    }else{
		first = C;
		second = A;
		third = B;
	    }
	}else{
	    if(B >= C){
		first = B;
		if(A >= C){
		    second = A;
		    third = C;
		}else{
		    second = C;
		    third = A;
		}
	    }else{
		first = C;
		second = B;
		third = A;
	    }
	}
	
	int len1 = first - second;
	int len2 = first - third;

	int count = 0;
	while(len1 > 0 || len2 > 0){
	    if(len1 % 2 == 0 && len2 % 2 == 0){
		count += len1/2 + len2/2;
		break;
	    }else if(len1 % 2 != 0 && len2 % 2 == 0){
		len1++;
		count++;
	    }else if(len1 % 2 == 0 && len2 % 2 != 0){
		len2++;
		count++;
	    }else{
		count += len1;
		len2 -= len1;
		len1 = 0;
	    }
	}

	System.out.println(count);
    }
}


Measured memory_bytes: 23764
<?php
$data = explode(' ', trim(fgets(STDIN)));
$n = $data[0];
$m = $data[1];
$point = explode(' ', trim(fgets(STDIN)));
sort($point);
for ($i = 0;$i < $m - 1; $i++) {
    $diff[] = $point[$i + 1] - $point[$i];
}
if ($m != 1) {
    rsort($diff);
    for ($i = 0; $i < $n - 1; $i++ ) {
        unset($diff[$i]);
    }
    echo array_sum($diff);
} else {
    echo 0;
}

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

int main(){
  int n;
  cin>>n;
  if (n<600) cout<<8<<endl;
  else if (n<800) cout<<7<<endl;
  else if (n<1000) cout<<6<<endl;
  else if (n<1200) cout<<5<<endl;
  else if (n<1400) cout<<4<<endl;
  else if (n<1600) cout<<3<<endl;
  else if (n<1800) cout<<2<<endl;
  else if (n<2000) cout<<1<<endl;
}

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

using namespace std;

#define rep1(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, n, m) for (long long i = (long long)(n); i <= (long long)(m); i++)
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
const long long mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    long long arr[n];
    rep1(i, n) cin >> arr[i];
    sort(arr, arr + n);
    long long sums[n + 1];
    sums[0] = 0;
    rep1(i, n) sums[i + 1] = sums[i] + arr[i];
    int count = 0;
    rep1(i, n) {
        long long current = arr[i];
        while (true) {
            long long j = upper_bound(arr, arr + n, 2 * current) - arr;
            if (j == n) {
                count++;
                break;
            }
            if (current == sums[j]) {
                break;
            }
            current = sums[j];
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1792
package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	slice := strings.Split(s.Text(), " ")
	n, _ := strconv.Atoi(slice[0])
	a, _ := strconv.Atoi(slice[1])
	b, _ := strconv.Atoi(slice[2])

	var sum int
	for i := 0; i <= n; i++ {
		total := 0
		for _, v := range strconv.Itoa(i) {
			val, _ := strconv.Atoi(string(v))
			total += val
		}
		if a <= total && total <= b {
			sum += i
		}
	}
	fmt.Println(sum)
}



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

typedef long long ll;

ll xorsum0X(ll X){
    if(X%4 == 3){
        return 0;
    }
    if(X%4 == 1){
        return 1;
    }
    if(X%4 == 0){
        return X;
    }
    if(X%4 == 2){
        return (ll)(X^1);
    }
}

int main(){
    ll A,B;
    cin >> A >> B;
    if(A == 0){
        cout << xorsum0X(B) << endl;
        return 0;
    }
    ll a,b;
    a = xorsum0X(A-1);
    b = xorsum0X(B);
    cout << (ll)(a^b) << endl;
}


Measured memory_bytes: 256