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

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long q = in.nextLong();
            long h = in.nextLong();
            long s = in.nextLong();
            long d = in.nextLong();
            if (2 * q < h) {
                h = 2 * q;
            }
            if (2 * h < s) {
                s = 2 * h;
            }

            long n = in.nextLong();
            out.println(Math.min(s * n, n / 2 * d + (n % 2) * s));
        }

    }
}



Measured memory_bytes: 21972
#include "bits/stdc++.h"

using namespace std;
 
const long long inf = 1e9;
#define ll long long
#define fr(i,a,n) for (int i=a;i<n;i++)
#define rfr(i,n,a) for (int i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define endl "\n"
typedef vector<int> VI;
typedef vector<ll> VL;
typedef priority_queue<int> Pqi;
typedef priority_queue<ll> Pql;

ll n, m, k;

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string x,y;
	cin >> x >> y;
	if (x == y.substr(0,y.size()-1)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int i;
        if(a>b){
        	i=a;a=b;b=i;
        }
        if(b>c){
        	i=b;b=c;c=i;
        }
        if(a>b){
        	i=a;a=b;b=i;
        }
        System.out.println(a+" "+b+" "+c );
	}

}

Measured memory_bytes: 26300
import Foundation

let MOD = 1000000007

func primeFactorExponents(n: Int) -> [Int] {
    var array: [Int] = []
    var factor = 0
    var factorCount = 0
    var q = n
    if n == 1 {
        return [1]
    }
    var i = 2
    while i*i<=n {
        if q % i == 0 {
            if i != factor {
                factor = i
                factorCount = 1
            } else {
                factorCount += 1
            }
            q /= i
        } else {
            if factor > 0 {
                array.append(factorCount)
                factor = 0
            }
            i += 1
        }
    }
    if q > 1 {
        array.append(1)
    }
    return array
}


let arr = readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
let N = arr[0]
let M = arr[1]

if M == 1 {
    print("1")
} else {

var ans = 1
let exponents = primeFactorExponents(M)
let MAXSIZE = exponents.maxElement()! + N

var fac = [Int](count: MAXSIZE, repeatedValue: 0)
var finv = [Int](count: MAXSIZE, repeatedValue: 0)
var inv = [Int](count: MAXSIZE, repeatedValue: 0)


// テーブルを作る前処理
func COMinit() {
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    var i = 2
    while i < MAXSIZE {
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
        i += 1
    }
}

// 二項係数計算
func COM(n: Int, _ k: Int) -> Int {
    if n < k {
        return 0
    }
    if n < 0 || k < 0 {
        return 0
    }
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
}

COMinit()

for e in exponents {
    let c = COM(e+N-1,N-1)
    ans *= c
    ans %= MOD
}

print(ans)
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
	
	#define 	ll 						long long int
	#define 	REP(i,a,b)				for(i=a;i<=b;i++)
	#define 	REPr(i,b,a)				for(i=b;i>=a;i--)
	#define 	pb 						push_back
    #define 	mp 						make_pair
    #define 	f  						first
   	#define 	s  						second
   	#define 	umap(type1,type2)		unordered_map<type1,type2>

ll mod = pow(10,9)+7;

void solve(){
	ll n;	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)	cin>>arr[i];
	ll sum=0;
	ll ans=0;
	for(ll i=n-1;i>0;i--){
		sum=(sum+arr[i])%mod;
		ans=(ans+(sum*arr[i-1]))%mod;
	}

	cout<<ans<<endl;
}

void pb_18(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	/***************************

		FuCk RATINGS I am in love with EXPERIENCE.

	***************************/

	int t;	t=1;
	while(t--)	solve();
}

int main(){
	pb_18();
}

Measured memory_bytes: 5184
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
    long long int n,m,ans=0,max=10000000000;
    string s;
    cin>>n>>m;
    vector<pair<long long int,int>>a(10000000);
    
    for(int i=0;i<n;i++){
        cin>>a[i].first>>a[i].second;
    }
    sort(a.begin(),a.end(),greater<>());
    for(int i=0;i<n;i++){
        if(a[n-1-i].second<=m){
            ans+=a[n-1-i].second*a[n-1-i].first;
            m-=a[n-1-i].second;
        }
        else{
            ans+=m*a[n-1-i].first;
            break;
        }
    }
    cout<<ans<<endl;
    
    
}

Measured memory_bytes: 156544
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pair<ll,ll> >   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pair<int,int> >   vpi;
typedef    vector<pair<double,double> >   vpd;
typedef    pair<double,double>   pd;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define all(x) x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}



int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{
ll n,k;
cin>>n>>k;
ll dp[k+1]={0};

ll an=0;
ll pot[k+1]={0};
for(ll i=1;i<=k;i++)
pot[i]=modpow(i,n);

/*for(int i=1;i<=k;i++)
cout<<pot[i]<<" ";
cout<<"\n";
*/

for(ll i=k;i>=1;i--)
{
	ll po=pot[k/i];
	ll ans=0;
	ans=madd(ans,po);
	
	
	
	for(ll j=i+i;j<=k;j+=i)
	ans=msub(ans,dp[j]);
	
	dp[i]=ans;
	an=madd(an,mmul(i,ans));
}

cout<<an;

}return 0;}

Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
 
// vector<int> vec(3); = vector<int> vec={0,0,0}
// vec.at()
// sort(num.begin(),num.end(), greater<int>());
// reverse(num.begin(),num.end());
 
// 切り上げ　a/b+1
//  1からNの総和　N*(N+1)/2
 
int main() {
  string x,S,y;
  cin >> x >> S >> y;
  
  cout << "A" << S.at(0) << "C" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(ll n, ll a, ll b, ll c, ll d, ll e){
  ll geko = min({a, b, c, d, e});
  cout << (n+geko-1LL) / geko + 4 << endl;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  solve(n, a, b, c, d, e);
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    set<int> s;
    for(int i=0; i<N; ++i) {
        int x;
        cin >> x;
        s.insert(x);
    }
    cout << (s.size() % 2 == 1 ? s.size() : s.size()-1) << endl;
}


Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int w,h;
char g[50][51];
 
int res(int y,int x){
  if(y<0||h<=y||x<0||w<=x){
    return 0;
  }else if(g[y][x]=='.'){
    g[y][x]='t';
    int a=0;
    for(int i=0;i<4;i++){
      int d[]={0,1,0,-1,0};
      a|=res(y+d[i],x+d[i+1]);
    }
    return a;
  }else{
    return g[y][x]=='B'|(g[y][x]=='W')<<1;
  }
}
 
void ff(int y,int x,int v){
  if(y<0||h<=y||x<0||w<=x){
    return;
  }else if(g[y][x]=='t'){
    const char *w="nbwn";
    g[y][x]=w[v];
    for(int i=0;i<4;i++){
      int d[]={0,1,0,-1,0};
      ff(y+d[i],x+d[i+1],v);
    }
  } 
}
 
int main(){
  while(cin>>w>>h,w|h){
    fill(g[0],g[50],0);
    for(int y=0;y<h;y++){
      cin>>g[y];
    }
    for(int y=0;y<h;y++){
      for(int x=0;x<w;x++){
    ff(y,x,res(y,x));
      }
    }
    cout<<count(g[0],g[50],'b')<<' '<<count(g[0],g[50],'w')<<endl;
  }
  return 0;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
#define ROCK ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f first
#define sec second
using namespace std;
typedef long long ll;
const long long int linf =(ll)9e18;
const int dx[8] = { 0, 0, 1, -1, 1, -1, 1, -1 }, dy[8] = { 1, -1, 0, 0, 1, -1, -1, 1 };

const int N=105,M=(int)1e5+5;
int n,weight;
ll dp[N][M],cost[N],w[N];

ll solve(int idx,int left){
    if(idx==n)return 0;
    ll &ret=dp[idx][left];
    if(~ret)return ret;
    ll ch1=solve(idx+1,left);
    ll ch2=0;
    if(left-cost[idx] >=0)ch2=solve(idx+1,left-cost[idx])+w[idx];
    return ret=max(ch1,ch2);
}

int main()
{
    ROCK;
    memset(dp,-1,sizeof dp);
    cin>>n>>weight;
    for(int i=0;i<n;i++)cin>>cost[i]>>w[i];
    cout<<solve(0,weight)<<endl;
    return 0;
}

Measured memory_bytes: 85692
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
using std::cin; using std::cout;
using std::endl;
using std::bitset; using std::map;
using std::queue; using std::priority_queue;
using std::set; using std::string;
using std::stringstream; using std::vector;
using std::pair; using std::make_pair;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<ULL, ULL> puu;
#ifdef DEBUG
using std::cerr;
#define pass cerr << "[" << __FUNCTION__ << "] : line = " << __LINE__ << endl;
#define display(x) cerr << #x << " = " << x << endl;
#define displaya(a, st, n)                      \
	{                                           \
		cerr << #a << " = {";                   \
		for (int qwq = (st); qwq <= (n); ++qwq) \
			if (qwq == (st))                    \
				cerr << a[qwq];                 \
			else                                \
				cerr << ", " << a[qwq];         \
		cerr << "}" << endl;                    \
	}
#define displayv(a) displaya(a, 0, (int)(a.size() - 1))
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#include <ctime>
class MyTimer {
	clock_t st;
public:
	MyTimer() { cerr << std::fixed << std::setprecision(0); reset(); }
	~MyTimer() { report(); }
	void reset() { st = clock_t(); }
	void report() {  cerr << "Time consumed: " << (clock() - st) * \
		1e3 / CLOCKS_PER_SEC << "ms" << endl; }
} myTimer;
#else
#define cerr if(false) std::cout
#define pass ;
#define display(x) ;
#define displaya(a, st, n) ;
#define displayv(a) ;
#define eprintf(...) if(0) fprintf(stderr, __VA_ARGS__)
class MyTimer {
public: void reset() {} void report() {}
} myTimer;
#endif

template<typename A, typename B>
std::ostream& operator << (std::ostream &cout, const pair<A, B> &x) {
	return cout << "(" << x.first << ", " << x.second << ")";
}
template<typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }

const int maxN = (1 << 17);
int n, A, B;

int q[maxN];

void solve(int L, int R, int S) {
	if(L >= R || L + 1 == R) return;
	int M = (L + R) >> 1;
	int d = 0;
	while(S >> d & 1 || (q[L] >> d & 1) == (q[R] >> d & 1)) ++d;
	int c = 0;
	while(c == d || (S >> c & 1)) ++c;
	q[M] = q[L] ^ (1 << c);
	q[M + 1] = q[M] ^ (1 << d);
	solve(L, M, S | (1 << d));
	solve(M + 1, R, S | (1 << d));
}

int main() {
	cin >> n >> A >> B;
	if(__builtin_popcount(A ^ B) % 2 == 0) {
		printf("NO\n"); return 0;
	} else {
		printf("YES\n");
	}
	q[0] = A; q[(1 << n) - 1] = B;
	solve(0, (1 << n) - 1, 0);
	for(int i = 0; i < (1 << n); ++i) printf("%d ", q[i]);
	printf("\n");
	return 0;
}


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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int n;  cin >> n;
  unordered_map<int, int> cnt1(n), cnt2(n);
  ll ans = 0;
  for (int i = 0; i < n; ++i){
    int ai; cin >> ai;
    int one = i-ai, two = i+ai;
    ans += cnt2[one] + cnt1[two];
    cnt1[one]++, cnt2[two]++;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 32344
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Text.Printf
import           Unsafe.Coerce

main :: IO ()
main = do
    [n, m] <- map read.words <$> getLine :: IO [Int]
    pys <- unfoldr parseInt2 <$> B.getContents
    putStr.unlines $ solve pys

solve :: [(Int, Int)] -> [String]
solve pys = map (\(_, p, j) -> show06d p j)
    . sort
    . concat
    . IM.elems
    . IM.mapWithKey (\p yis -> map (\(j, (_, i)) -> (i, p, j)) . zip [1 :: Int ..] $ sort yis)
    . foldl' (\acc (i, (p, y)) -> IM.insertWith (++) p [(y, i)] acc) IM.empty
    $ zip [0 :: Int ..] pys

show06d :: Int -> Int -> String
show06d x y = printf "%06d%06d" x y

-------------------------------------------------------------------------------
type Parser a = B.ByteString -> Maybe (a, B.ByteString)

parseInt :: Parser Int
parseInt = B.readInt . B.dropWhile isSpace

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
    (,) <$> StateT (B.readInt . B.dropWhile isSpace)
        <*> StateT (B.readInt . B.unsafeTail)



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

int main() {
  string s;
  cin >> s;
  
  vector<vector<int>> dp(s.size(), vector<int>(2, 0));
  dp[0][0] = 1;
  dp[1][1] = 1;
  if (s[0] != s[1]) dp[1][0] = 2;
  for (int i = 2; i < s.size(); ++i) {
    dp[i][0] = max(dp[i][0], dp[i-1][1] + 1);
    dp[i][1] = max(dp[i][1], dp[i-2][0] + 1);
    if (s[i-1] != s[i]) dp[i][0] = max(dp[i][0], dp[i-1][0] + 1);
    if (i > 3) if (s[i-3] != s[i-1] || s[i-2] != s[i]) dp[i][1] = max(dp[i][1], dp[i-2][1] + 1);
  }
  int ans = max(dp[s.size()-1][0], dp[s.size()-1][1]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14456
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

typedef struct {
	int parent = 0;
	int height = 1;
	ll mem = 1;
}node_t;
vector<node_t> node;

int root(int n) {
	if (node[n].parent == 0) return n;
	node[n].parent = root(node[n].parent);
	return node[n].parent;
}

void unite(int root_a, int root_b) {
	int up, low;
	if (node[root_a].height >= node[root_b].height)
		up = root_a, low = root_b;
	else
		up = root_b, low = root_a;

	node[up].height = max(node[up].height, node[low].height + 1);
	node[low].parent = up;
	node[up].mem += node[low].mem;
}

int main(void) {
	ll N, M;
	cin >> N >> M;

	vector<pair<int, int>> bri(M);
	for (int i = 0; i < M; i++) {
		cin >> bri[i].first >> bri[i].second;
	}

	node = vector<node_t>(N + 1);
	vector<ll> ans(M);
	ans[M - 1] = N * (N - 1) / 2;
	for (int i = M - 1; i >= 1; i--) {
		ans[i - 1] = ans[i];
		int a = bri[i].first, b = bri[i].second;
		int art = root(a), brt = root(b);
		if (art == brt) continue;
		ll temp = node[art].mem * node[brt].mem;
		ans[i - 1] -= temp;
		unite(art, brt);
	}

	for (int i = 0; i < M; i++) {
		cout << ans[i] << endl;
	}

}

Measured memory_bytes: 4480
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int min = Integer.MAX_VALUE;
        int minPoint = 0;
        int max = Integer.MIN_VALUE;
        int maxPoint = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (min > a[i]) {
                min = a[i];
                minPoint = i;
            }
            if (max < a[i]) {
                max = a[i];
                maxPoint = i;
            }
            min = Math.min(min, a[i]);
            max = Math.max(max, a[i]);
        }
        int changeNum = 0;
        int pos = 0;
        if (Math.abs(min) > Math.abs(max)) {
            changeNum = min;
            pos = minPoint;
        } else {
            changeNum = max;
            pos = maxPoint;
        }
        // n - 1回の処理
        for (int i = 0; i < n; i++) {
            if (i != pos) {
                a[i] += changeNum;
            }
        }
        // 正の数の処理
        if (changeNum > 0) {
            for (int i = 0; i < n - 1; i++) {
                a[i + 1] = a[i];
            }
        } else {
            for (int i = 0; i < n - 1; i++) {
                a[n - 2 - i] += a[n - 1 - i];
            }
        }
        System.out.println(2 * n - 2);
        // n - 1回の処理
        for (int i = 0; i < n; i++) {
            if (pos == i)
                continue;
            System.out.println((pos + 1) + " " + (i + 1));
        }
        if (changeNum > 0) {
            for (int i = 1; i < n; i++) {
                System.out.println(i + " " + (i + 1));
            }
        } else {
            for (int i = n; i > 1; i--) {
                System.out.println(i + " " + (i - 1));
            }
        }
    }
}

Measured memory_bytes: 23252
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
  string moji;
  cin >> moji;
  while (moji.length()) {
    moji.pop_back();
    int l = moji.length();
    if (l % 2 == 0) {
      string s1 = moji.substr(0, l / 2);
      string s2 = moji.substr(l / 2);
      if (s1.compare(s2) == 0) {
        cout << l;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map &:to_i

m = 1000
stock = 0

(N-1).times do |i|
    if stock > 0 then
        if A[i] > A[i+1] then
            m += stock * A[i]
            stock = 0
        end
    else
        if A[i] < A[i+1] then
            stock = m / A[i]
            m %= A[i]
        end
    end
end

m += stock * A[N-1]
p m

Measured memory_bytes: 14348
#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define sz(a) lld((a).size())
#define YES printf("YES\n")
#define NO printf("NO\n")
#define all(c) (c).begin(),(c).end()
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
lld ctl(char x,char an='a') {return (lld)(x-an);}
char ltc(lld x,char an='a') {return (char)(x+an);}
#define bit(x,j) ((x>>j)&1)
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mxm(a,b) a = max(a,b)
#define mnm(a,b) a = min(a,b)
#define endl '\n'
#define fre freopen("1.in","r",stdin); freopen("1.out","w",stdout);
#define N 1000005
int main()
{
    //sync;
    lld a,b;
    cin>>a>>b;
    lld ans = a-1 + (b>=a);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1000000007;
const int INF=1001001001;
int func(int64_t x){
  int cnt=0;
   while(x){
     cnt++;
     x/=10;
   }
   return cnt;
}
int main() {
  int64_t N;
  cin>>N;
  int MIN=INF;
  for(int64_t i=1;i*i<=N;i++){
    if(N%i!=0){continue;}
    int64_t r=N/i;
    int m=max(func(i),func(r));
    chmin(MIN,m);
  }
  cout<<MIN<<endl;
  return 0;  
}

Measured memory_bytes: 3608
X = int(input())
num = X

def isPrime(num):
	if num == 1 or num == 2:
		return True
	for i in range(2,num):
		if num % i == 0:
			return False
	return True


while True:
	if isPrime(num):
		print(num)
		break
	num += 1

Measured memory_bytes: 3064
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=4999999996000000001;


int main(){
    int n,k;
    cin>>n>>k;
    vector<vector<int> > G(n);
    vector<bool> visited(n,false);
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    queue<int> q;
    q.push(0);
    ll ans=k;
    while(!q.empty()){
        int now=q.front();
        q.pop();
        visited[now]=true;
        int minu;
        if(now==0){
            minu=1;
        }else{
            minu=2;
        }
        for(int to:G[now]){
            if(visited[to]) continue;
            ans*=k-minu;
            ans%=MOD;
            q.push(to);
            minu++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 9576
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<bool>> like(n, vector<bool>(m, false));
	rep(i, n) {
		int k;
		cin >> k;
		rep(j, k) {
			int a;
			cin >> a;
			a--;
			like[i][a] = true;
		}
	}
  int ans=0;
	rep(i, m) {
		bool flag = true;
		rep(j, n) {
			if (like[j][i] == false) flag = false;
		}
		if (flag) ans++;
	}
  cout<<ans<<endl;
}

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

pair<int,int> a[1000];
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};

int main(){

  while(1){
    int N;
    int xmax = 0,xmin = 0,ymax = 0,ymin = 0;
    cin >> N; if(N==0) break;

    for(int i = 0; i < N; i++) a[i] = make_pair(0,0);

    for(int i = 1; i < N; i++){
      int n,d;
      cin >> n >> d;

      a[i] = make_pair(a[n].first + dx[d],a[n].second + dy[d]);
      //cout << a[i].first << " " << a[i].second << endl;
      for(int i = 0; i < N; i++){
        xmax = max(xmax,a[i].first);
        xmin = min(xmin,a[i].first);
        ymax = max(ymax,a[i].second);
        ymin = min(ymin,a[i].second);
      }

      //cout << xmax << " " << xmin << " " << ymax << " " << ymin << endl;
    }
    cout << xmax-xmin+1 << " " << ymax-ymin+1 << endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    string S;
    cin >> S;

    vector<ll> ans(S.size(), 0);
    ll r_num = 0, l_num = 0;
    ll pre_r = -1;

    S.push_back('R');

    for (ll i = 0; i < S.size(); i++) {
        if (S[i] == 'R') {
            r_num++;
            pre_r = i;
        } else {
            l_num++;
            if (S[i + 1] == 'R') {
                //ここで計算
                ans[pre_r] = (r_num + 1) / 2 + l_num / 2;
                ans[pre_r + 1] = r_num / 2 + (l_num + 1) / 2;
                r_num = 0;
                l_num = 0;
            }
        }
    }

    for (ll i = 0; i < S.size() - 1; i++) {
        cout << ans[i] << " \n"[i == S.size() - 2];
    }
}

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

typedef long long ll;
ll N;
vector<ll> B;
ll R;
const ll INF = 1ll << 60;

int main() {
  cin >> N;
  B.resize(N);
  for (ll i = 0; i < N - 1; ++i) cin >> B[i];
  for (ll i = 0; i < N; ++i) {
    R += min((i == 0 ? INF : B[i - 1]), (i == N - 1 ? INF : B[i]));
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<

typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second

const int MAX = 55;

ll dp[MAX][2];
int pp[MAX];

int main()
{
  int n, p;
  scanf("%d%d", &n, &p);

  REP(i, n)
    scanf("%d", &pp[i]);    

  dp[0][0] = 1;
  REP(i, n) {
    REP(j, 2) {
      dp[i+1][j] += dp[i][j];
      dp[i+1][(j+pp[i])%2] += dp[i][j];
    }
  }

  printf("%lld\n", dp[n][p]);  

  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

template <typename T>
T mypow(T a, T b)
{
    if (b == 0)
        return 1;
    T tmp = mypow(a, b / 2);
    if (b % 2)
        return (((tmp * tmp) % MOD) * a) % MOD;
    else
        return (tmp * tmp) % MOD;
}

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

    ll n, k;
    cin >> n >> k;
    cout << mypow(k, n) << endl;
}



Measured memory_bytes: 3212
#![allow(unused_imports, non_snake_case)]
use proconio::{
    input, fastout,
    marker::{Chars, Bytes, Usize1}
};

const MOD: i64 = 998244353;

#[fastout]
fn main() {
    input!{
        N: usize, K: usize,
        g: [(usize, usize); K]
    }
    let mut b = vec![0; N];
    b[0] = 1;
    b[1] = -1;
    for i in 0..N-1 {
        if b[i] == 0 {
            continue;
        }
        for &(l, r) in &g {
            if i + l < N {
                b[i+l] += b[i];
            }
            if i + r + 1 < N {
                b[i+r+1] -= b[i];
            }
        }
        b[i+1] = (b[i+1] + b[i]) % MOD;
    }
    println!("{}", (b[N-1] + MOD) % MOD);
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M=3e5+5;
int ct[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		ct[i+1]=ct[i];
		if(s[i]=='E')
			ct[i+1]++;
	}
	int res=n;
	for(int i=1;i<=n;i++)
	{
		int a=(i-1)-ct[i-1];
		int b=(ct[n]-ct[i]);
		res=min(res,a+b);
	}
	cout<<res<<"\n";
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef std::vector<ll> vec;
typedef std::vector<ld> vecld;
typedef std::vector< std::vector<ll> > vecvec;
typedef std::pair<ll, ll> pr;
typedef std::vector< pr > vpr;

#define tin ll t;cin>>t;while(t--)
#define fio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define sz(a) (ll)((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define trvect(c,i) for(vector<ll>::iterator i = (c).begin(); i != (c).end(); i++)
#define trset(c,i) for(set<ll>::iterator i = (c).begin(); i != (c).end(); i++)
#define trmap(c,i) for(map<ll,ll>::iterator i = (c).begin(); i != (c).end(); i++)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define present(c,x) ((c).find(x) != (c).end())
#define ff first
#define ss second
#define mk make_pair
#define sq(a) (a)*(a)
#define cube(a) (a)*(a)*(a)
#define cnti(x) (__builtin_popcount(x)) //number of set bits in x
#define mst(c) memset((c),0,sizeof((c)))


int main(){


	//fio;

	/////////////////////////////////////////

	ll k,x;
	cin>>k>>x;
	for(int i=(x-k+1);i<=(x+k-1);i++)
		cout<<i<<" ";





	////////////////////////////////////////////////




    return 0;












}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){


  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(abs((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3)) < 0.0000000001){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }

  }

  return 0;
}

Measured memory_bytes: 1224
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;


int N, L;
int64 a[100000];

vector<pair<int64, int>> mp;

int main() {
    cin >> N >> L;
    for (int j = 0; j < N; ++j) {
        cin >> a[j];
        mp.emplace_back(-a[j], j);
    }
    sort(begin(mp), end(mp));

    int64 tt[100000];
    fill(tt, tt+N, 0);

    int64 ans = 0;
    for (pair<int64, int>& p : mp) {
        int64 t = -p.first, i = p.second;
        if (i > 0) tt[i] = max(tt[i], tt[i-1]);
        if (i < N-1) tt[i] = max(tt[i], tt[i+1]);

        tt[i] += L - t;
        ans = max(ans, tt[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6156
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

int main() {

    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    vector<int> action(N, 0);
    if (A[N - 2] <= A[N - 1]) action[N - 1] = -1;
    for (int i = N - 2; i >= 1; i--) {
        if (A[i - 1] <= A[i] && A[i] >= A[i + 1]) action[i] = -1;
        else if (A[i - 1] >= A[i] && A[i] <= A[i + 1]) action[i] = 1;
        else if (A[i - 1] <= A[i] && A[i] <= A[i + 1]) {
            if (i >= 2 && A[i - 2] <= A[i - 1]) action[i] = 1;
        }
    }
    if (A[0] <= A[1]) action[0] = 1;

    ll ans = 1000;
    ll k = 0;
    rep(i,N) {
        if (action[i] == 1) {
            ll c = ans / A[i];
            k += c;
            ans -= c * A[i];
        } else if (action[i] == -1) {
            ans += k * A[i];
            k = 0;
        }
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3636
while 1:
 H, W = map(int,raw_input().split())
 if H + W == 0:break
 for h in range(H):
  if h % 2 == 0:
   if W % 2 == 0:
    print ('#.'*(W//2))
   else:
    print ('#.'*(W//2)+'#')
  else:
   if W % 2 == 0:
    print ('.#'*(W//2))
   else:
    print ('.#'*(W//2)+'.')
 print ''


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

int main(){
  int n,a,b,c,d;
  string s;
  cin>>n>>a>>b>>c>>d>>s;
  a--; b--; c--; d--;
  bool ans=0;
  if(c>d){
    int tmp=0;
    for(int i=b-1; i<=d+1; i++){
      if(s[i]!='#') tmp++;
      else tmp=0;
      if(tmp==3) ans=1;
    }
  }else{
    ans=1;
  } 
  if(ans){
    for(int i=b; i<d; i++){
      if(s[i]=='#' && s[i+1]=='#') ans=0;
    }
    for(int i=a; i<c; i++){
      if(s[i]=='#' && s[i+1]=='#') ans=0;
    }
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}



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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll a,b,c;
	cin >> a >> b >> c;
	if(a<b && b<c) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


Measured memory_bytes: 3088
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

set<LL> yakusuu(LL terN) {
	set<LL> ans;
	for (LL i = 2; i * i <= terN; ++i) {
		if (terN % i == 0) {
			ans.insert(i);
			ans.insert(terN / i);
		}
	}
	if (terN > 1) {
		ans.insert(terN);
	}
	return ans;
}

void solve() {
	LL N;
	cin >> N;
	set<LL> ans;
	set<LL> res;
	res = yakusuu(N);
	
	int len = res.size();
	set<LL>::iterator itr;
	itr = res.begin();
	while(itr != res.end()){
		LL ter = N;
		LL R = *itr;
		while (ter % R == 0) {
			ter /= R;
		}
		ter %= R;
		if (ter == 1) {
			ans.insert(R);
		}

		++itr;
	}

	res = yakusuu(N - 1);
	itr = res.begin();
	while (itr != res.end()) {
		ans.insert(*itr);
		++itr;
	}

	cout << ans.size() << endl;
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 512
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        String s = sc.nextLine();
        for (int i = 0; i < s.length(); i += 2) {
            _out.print(s.charAt(i));
        }
        _out.println();
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 24124
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n; cin>>n;
    map <int,int> ma;
    rep(i,n) {int a; cin>>a; ma[a]++;}
    int x = ma.size();
    if(!(x%2)) x--;
    cout<<x<<endl;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int k, a, b; cin >> k >> a >> b;

	int cnt = b / k - (a - 1) / k;

	if (cnt)
		cout << "OK";
	else
		cout << "NG";
	return 0;
}

Measured memory_bytes: 3612
import sys
import math
from itertools import permutations
input = sys.stdin.readline

N,M=map(int,input().split())

arr=[1,N]
flag=True
for i in range(M):
	l,r=map(int,input().split())
	if flag:
		arr[0]=max(l,arr[0])
		arr[1]=min(r,arr[1])
	if arr[1]<arr[0]:
		flag=False

if flag:
	print(arr[1]-arr[0]+1)
else:
	print(0)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	char str[2000];
	scanf("%[^\n]",str);
    for(int i=0;str[i]!=NULL;i++){
        if(str[i]=='a'&&str[i+1]=='p'&&str[i+2]=='p'&&str[i+3]=='l'&&str[i+4]=='e')str[i]='p',str[i+1]='e',str[i+2]='a',str[i+3]='c',str[i+4]='h';
        else if(str[i]=='p'&&str[i+1]=='e'&&str[i+2]=='a'&&str[i+3]=='c'&&str[i+4]=='h')str[i]='a',str[i+1]='p',str[i+2]='p',str[i+3]='l',str[i+4]='e';
    }
	cout<<str<<endl;
	return 0;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ll t,n,i,k,sum;
    cin>>n;vector<ll> v(n+1);
    for(i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    k=n;
    sum=v[n];
    n--;
    while(k>2)
    {
        if(k==3)
            sum=sum+v[n];
        else
            sum=sum+(2*v[n]);
        k=k-2;
        n--;

    }
    cout<<sum;
}


Measured memory_bytes: 4764
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int n,m;
int h[1600];
int w[1600];

#define array_num 1600000
int mh[array_num];
int mw[array_num];
int main(){
	while(1){
		cin >> n >> m;
		if(n==0&&m==0) break;
		REP(i,array_num){
			mh[i] = 0;
			mw[i] = 0;
		}
		REP(i,n) cin >> h[i];
		REP(i,m) cin >> w[i];
		REP(i,n){
			ll int sum = h[i];
			mh[sum]++;
			FOR(j,i+1,n){
				sum += h[j];
				mh[sum]++;
			}
		}
		REP(i,m){
			ll int sum = w[i];
			mw[sum]++;
			FOR(j,i+1,m){
				sum += w[j];
				mw[sum]++;
			}
		}
		ll int ans = 0;
		REP(i,array_num){
			ans += mw[i]*mh[i];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 13664
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main()
{
  int a, b;
  cin >> a >> b;
  string A = "";
  string B = "";
  string aa = to_string(a);
  string bb = to_string(b);
  rep(i,b){
    A += aa;    
  }
  rep(i,a){
    B += bb;    
  }
  if(A < B){
    cout << A <<endl;
  }else{
    cout << B <<endl;
  }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ctoi(x) x-'0'
#define pshb(a) cin >> x;a.push_back(x)
#define fr(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);
#define Test ll q ; cin>>q ; while (q--)
#define ph push_back
#define f first
#define s second
using namespace std ;
int main ()
{
    ll a, b ;
    cin>>a>>b ;
    for (int i =1 ; i<=10000000; i++)
    {
        ll t = (i *8)/100, c = (i)/10 ;
        if (t==a&&c==b)
            return cout<< i, 0 ;
    }
    cout<<-1 ;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		// 
		if(InRange(B, (N + (A - 1))/ A, N - A + 1)){
			int cmp = (N + (A - 1))/ A;
			List<int>[] L = new List<int>[cmp];
			for(int i=0;i<cmp;i++) L[i] = new List<int>();
			for(int i=0;i<N;i++){
				L[i / A].Add(i + 1);
			}
			
			Array.Reverse(L);
			int rem = B - cmp;
			int now = 0;
			while(rem > 0){
				if(rem >= L[now].Count - 1){
					L[now].Reverse();
					rem -= L[now].Count - 1;
				} else {
					L[now].Reverse(0,rem+1);
					rem = 0;
				}
				now++;
			}
			List<int> ans = new List<int>();
			for(int i=0;i<cmp;i++) foreach(var n in L[i]) ans.Add(n);
			Console.WriteLine(String.Join(" ",ans));
			return;
		}
		if(InRange(A, (N + (B - 1))/ B, N - B + 1)){
			int cmp = (N + (B - 1))/ B;
			List<int>[] L = new List<int>[cmp];
			for(int i=0;i<cmp;i++) L[i] = new List<int>();
			for(int i=0;i<N;i++){
				L[i / B].Add(i + 1);
			}
			
			for(int i=0;i<cmp;i++){
				L[i].Reverse();
			}
			
			int rem = A - cmp;
			int now = 0;
			while(rem > 0){
				if(rem >= L[now].Count - 1){
					L[now].Reverse();
					rem -= L[now].Count - 1;
				} else {
					L[now].Reverse(0,rem+1);
					rem = 0;
				}
				now++;
			}
			List<int> ans = new List<int>();
			for(int i=0;i<cmp;i++) foreach(var n in L[i]) ans.Add(n);
			Console.WriteLine(String.Join(" ",ans));
		
			return;
		}
		Console.WriteLine(-1);
	}
	
	bool InRange(int t, int l, int r){
		return l <= t && t <= r;
	}
	
	int N,A,B;
	public Sol(){
		var d = ria();
		N = d[0]; A = d[1]; B = d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 35928