akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
using namespace std;

int main()
{
    int n;
    int i, j;
    long long int x, y = 0, min;
    
    cin >> n;
    
    int a[n];
    
    cin >> a[0];
    x = a[0];
    
    for(i = 1; i < n; i++) {
        cin >> a[i];
        y = y + a[i];
    }
    
    min = llabs(x-y);
    
    for(j = 1; j < n-1; j++) {
        x = x + a[j];
        y = y - a[j];
        
        if(llabs(x-y) < min) {
            min = llabs(x-y);
        }
    }
    
    cout << min << endl;
    
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
As = list(map(int, input().split()))
P = 10**9 + 7

rlt = 0
pw = 1
for i in range(61):
  c0 = 0
  c1 = 0
  for j in range(N):
    a = As[j]
    if a % 2 == 0:
      c0 += 1
    else:
      c1 += 1
    As[j] = a//2
  rlt += c0*c1*pw % P
  rlt %= P
  pw *= 2
  
print(rlt)

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

int main() {
    int N;
    cin >> N;
    ll Y;
    cin >> Y;

    ll remain = Y - 1000 * N;
    int a = -1, b = -1, c = -1;
    for (int i=0; i<=N; i++) {
        for (int j=0; j <= (N - i); j++) {
            if (9000*i + 4000*j == remain) {
                c = N - i - j;
                if (10000* i + 5000*j + 1000*c == Y) {
                    cout << i << " " << j << " " << c << endl;
                    return 0;
                }
            }
        }
    }

    cout << a << " " << b << " " << c << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type pair struct{ l, r, i int }

	var n, q int
	Fscan(in, &n, &q)
	a := make([]int, n+1)
	for i := 1; i <= n; i++ {
		Fscan(in, &a[i])
	}
	qs := make([]pair, q)
	for i := range qs {
		Fscan(in, &qs[i].l, &qs[i].r)
		qs[i].i = i
	}
	sort.Slice(qs, func(i, j int) bool { return qs[i].r < qs[j].r })

	tree := make([]int, n+1)
	add := func(i int, val int) {
		for ; i <= n; i += i & -i {
			tree[i] += val
		}
	}
	sum := func(i int) (res int) {
		for ; i > 0; i &= i - 1 {
			res += tree[i]
		}
		return
	}
	query := func(l, r int) int { return sum(r) - sum(l-1) }

	ans := make([]int, q)
	posR := make([]int, n+1)
	i := 1
	for _, q := range qs {
		for ; i <= q.r; i++ {
			if p := posR[a[i]]; p > 0 {
				add(p, -1)
			}
			add(i, 1)
			posR[a[i]] = i
		}
		ans[q.i] = query(q.l, q.r)
	}
	for _, v := range ans {
		Fprintln(out, v)
	}
}

func main() { run(os.Stdin, os.Stdout) }


Measured memory_bytes: 40972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

const long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

vector<int> v[11];

void solve() {
  int n,d;
  cin >> n >> d;
  REP(i,n) {
    v[i].clear();
  }
  REP(i,n) {
    REP(j,d) {
      int a;
      cin >> a;
      v[i].pb(a);
    }
  }
  int ans = 0;
  REP(i,n) {
    for (int j = i + 1; j < n; j++) {
      int sum = 0;
      REP(k,d) {
        sum += (v[i][k] - v[j][k]) * (v[i][k] - v[j][k]);
      }
      int tmp = sqrt(sum);
      if (tmp * tmp == sum) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

int main(int argc, char *argv[]){

  /* Regular */
  int case_num = 1;
  if (argc > 1 && stoi(argv[1])) cin >> case_num;
  REP(case_no, case_num) {
    cerr << endl << "case " << case_no + 1 << endl;
    solve();
  }
  
  // /* AOJ */
  // solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int p[8];
int q[8];

bool check(int a[], int b[]) {
	for (int i = 0; i < n; i++) {
		if (a[i] != b[i]) return false;
	}
	return true;
}

int perm[8];
bool used[9] = {false};
int cnt = 0;
int a, b;
void dfs(int depth) {
	if (depth == n) {
		if (check(perm, p)) { a = cnt; }
		if (check(perm, q)) { b = cnt; }
		cnt++;
		return;
	}
	
	for (int i = 1; i <= n; i++) {
		if (used[i] == true) {
			continue;
		}
		
		used[i] = true;
		perm[depth] = i;
		dfs(depth + 1);
		used[i] = false;
	}
}

int main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> p[i];
	rep(i, n) cin >> q[i];
	dfs(0);
	cout << abs(a - b) << endl;
	return 0;
}

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

using namespace std;

#define int long long
#define pb push_back
#define fi first
#define se second

const int N = 1e5 + 5, inf = 1e18 + 123;
int n, x, b[N], l[N], r[N];

bool check (int lim) {
    int dist = 0;
    for (int i = 0; i < n; ++i) dist += 1LL * l[i] * b[i];
    vector< pair<int, int> > vec;
    for (int i = 0; i < n; ++i) vec.pb( { 1LL * (r[i] - l[i]) * b[i] - 1LL * x * r[i], i } );
    sort(vec.begin(), vec.end() );
    int lst = lim / x; lim %= x;

    if (lst < n) {
        int sum = 0, minn = inf;
        for (int i = 0; i <= lst; ++i) sum += vec[i].fi;
        for (int i = 0; i < n; ++i) {
            int tmp;
            if (lim >= b[ vec[i].se ]) tmp = (r[ vec[i].se ] - l[ vec[i].se ]) * b[ vec[i].se ] - lim * r[ vec[i].se ];
            else tmp = -lim * l[ vec[i].se ];
            if (i <= lst) minn = min(minn, sum - vec[i].fi + tmp);
            else minn = min(minn, sum - vec[lst].fi + tmp);
        }
        dist += minn;
    }
    else {
        for (int i = 0; i < n; ++i) dist += vec[i].fi;
    }

    return dist <= 0;
}

int32_t main () {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> x;
    for (int i = 0; i < n; ++i) cin >> b[i] >> l[i] >> r[i];

    int L = 0, R = 1e10;
    while (L < R) {
        int mid = (L + R) >> 1;
        if (check(mid) ) R = mid;
        else L = mid + 1;
    }

    cout << L;

    return 0;
}


Measured memory_bytes: 6780
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

func Solve() {
  var N int
  NextInt(&N)
  var A []int
  NextIntVec(&A)
  T := make([][]int, N)
  for i := range T {
    T[i] = make([]int, 0)
  }
  var a, b int
  for i := 1; i < N; i++ {
    NextInt(&a, &b)
    a, b = a - 1, b - 1
    T[a] = append(T[a], b)
    T[b] = append(T[b], a)
  }
  P := make([]int, N)
  for i := range P[1:] {
    P[i + 1] = -1
  }
  Q := make([]int, N)
  pos := 1
  for _, q := range Q {
    for _, adj := range T[q] {
      if P[adj] != -1 { continue }
      P[adj] = q
      Q[pos] = adj
      pos++
    }
  }
  DP := make([][]int, N)
  for i := range DP {
    DP[i] = make([]int, 2)
  }
  ans := "YES"
  for i := N - 1; 0 <= i; i-- {
    u := Q[i]
    p := P[u]
    if u != 0 && len(T[u]) == 1 {
      DP[u][0] = A[u]
    }
    C := 2 * A[u] - DP[u][0]
    DP[u][1] = MaxInt(C, DP[u][1])
    if C < 0 || A[u] < DP[u][1] || (u == 0 && 1 < len(T[u]) && 0 < C) {
      ans = "NO"
      break
    }
    DP[p][0] += C
    DP[p][1] = MaxInt(C, DP[p][1])
  }
  Write(ans)
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 15104
# Wrote in Mar 5, 2020 18:42 by reetok
require 'time'
require 'prime'
require 'bigdecimal'
def inp(type=:to_i,spst=" ")
  return eval("gets.chomp.split(#{spst}).map(&:#{type})")
end
def inpf() return self.inp(:to_f," ") end
def inps() return self.inp(:to_s," ") end
def r_up(a, b) (a/b).ceil end
def r_down(a, b) (a/b).floor end
def sum(a) a.inject(:+) end
def big(a,b) return (a>b)? a:b end
def small(a,b) return (a<b)? a:b end
def minp(n,datatype=:to_i)
  t = []
  n.times do
    t.push(eval("gets.chomp.#{datatype.to_s}"))
  end
  return t
end
def yes() puts "Yes" end
def no() puts "No" end
def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end
class Integer
  def divisor_list
    devisors = [1]
    2.upto(self/2) do |i|
      devisors << i if self%i == 0
    end
    devisors << self
    return devisors.uniq.sort
  end
end
class Array
  def upper(a) #aより上
    self.sort.select{|n|n>=a}
  end
  def downer(a) #aより下
    self.sort.select{|n|n<=a}
  end
end

#---------------

n = gets.to_i
a = []
n.times do
  a.push(gets.chomp.split)
end

s,h,c,d = [*1..13],[*1..13],[*1..13],[*1..13]

a.each do |arr|
    eval(arr[0].downcase).delete(arr[1].to_i)
end

s.each do |sa|
    puts "S #{sa}"
end
h.each do |ha|
    puts "H #{ha}"
end
c.each do |ca|
    puts "C #{ca}"
end
d.each do |da|
    puts "D #{da}"
end



Measured memory_bytes: 9232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
//import java.util.ArrayList;
//import java.util.Arrays;
import java.util.HashMap;
//import java.util.LinkedList;
//import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
	
	static HashMap<Integer,Integer> hm;
//	static int mx;
	static boolean[] arr;
	
	public static int gcd(int a,int b) {
		
		while(b!=0) {
			int tmp=a;
			a=b;
			b=tmp%b;
		}
		return a;
	}
	
	public static boolean solve() {
		
		for(int p=2;p<=1000;p++) {
			
			int mul=1;
			int ctr=0;
			
			while(p*mul<=1000000) {
				if(hm.containsKey(p*mul)) {
					ctr++;
				}
				mul++;
			}
			if(ctr>=2) {
				return false;
			}
		}
		
		return true;
	}
	
	public static boolean sieve() {
		
		Arrays.fill(arr, true);
		for(int w=2;w*w<=1000000;w++) {
			if(arr[w]) {
				
				for(int r=w*w;r<=1000000;r+=w) {
					arr[r]=false;
				}
			}
		}
		
		for(int d=2;d<=1000000;d++) {
			if(arr[d]) {
				int k=1;
				int ctr=0;
				while(d*k<=1000000) {
					if(hm.containsKey(d*k)) {
						ctr++;
					}
					k++;
				}
				if(ctr>=2) {
					return false;
				}
			}
		}
		
		return true;
	}
	
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		
		Rf.init(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		
		int N=Rf.nextInt();
		int[] A=new int[N];
		
		arr=new boolean[1000001];
		hm=new HashMap<Integer,Integer>();
		
		boolean flag=false;
		
		for(int x=0;x<N;x++) {
			A[x]=Rf.nextInt();
//			mx=Math.max(mx,A[x]);
			if(hm.containsKey(A[x]) && A[x]!=1) {
				flag=true;
			}
			else {
				hm.put(A[x],1);
			}
		}	
			
		int setwise=A[0];
		for(int h=1;h<N;h++) {
			setwise=gcd(setwise,A[h]);
		}
		
		if(setwise!=1) {
			pw.println("not coprime");
		}
		else {
			
			boolean check = sieve();
			if(check && !flag) {
				pw.println("pairwise coprime");
			}
			else {
				pw.println("setwise coprime");
			}
		}
		
		pw.close();
		
	}

}

/** Class for buffered reading int and double values */
class Rf {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	/** call this method to initialize reader for InputStream */
	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	/** get next word */
	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens()) {
			// TODO add check for eof if necessary
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
	
	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
}


Measured memory_bytes: 136444
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
        cin >> a[i];
    map<ll,ll> p;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
    ans += p[i - a[i]];
    p[i + a[i]]++;
    }
   
    cout << ans << endl;
}

Measured memory_bytes: 27376
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 2e5 + 11;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int n, m;


main () {
	cin >> n >> m;
	int l = 1, r = ((m + 1) / 2) * 2;
	for (int i = 1; i <= m; i += 2) {
		cout << l << ' ' << r << endl;
		++l, --r;
	}
	
	l = ((m + 1) / 2) * 2 + 1, r = l + (m / 2)*2;
	for (int i = 2; i <= m; i += 2) {
		cout << l << ' ' << r << endl;
		++l, --r;
	}

	
	
}


Measured memory_bytes: 3632
H, W = map(int, input().split())
S = [input() for _ in range(H)]

INF = 10 ** 18
dp = [[INF for _ in range(W)] for _ in range(H)]

if S[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0

for j in range(1, W):
    if S[0][j] == "." or (S[0][j] == "#" and S[0][j - 1] == "#"):
        dp[0][j] = dp[0][j - 1]
    else:
        dp[0][j] = dp[0][j - 1] + 1

for i in range(1, H):
    if S[i][0] == "." or (S[i][0] == "#" and S[i - 1][0] == "#"):
        dp[i][0] = dp[i - 1][0]
    else:
        dp[i][0] = dp[i - 1][0] + 1

    
    for j in range(1, W):
        if S[i][j] == ".":
            dp[i][j] = min(dp[i - 1][j], dp[i][j - 1])
        else:
            dp[i][j] = min(dp[i - 1][j] if S[i - 1][j] == "#" else dp[i - 1][j] + 1,
                            dp[i][j - 1] if S[i][j - 1] == "#" else dp[i][j - 1] + 1)

print(dp[-1][-1])

Measured memory_bytes: 41456
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int main() {
  char c;
  cin >> c;
  c++; 
  printf("%c",c); 
}



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

int main(){
    long long int a, b, k;
    cin >> a >> b >> k;
    if(a >= k) cout << a - k << " " << b << endl;
    else cout << 0 << " " << max(b-(k-a), 0LL) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

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

    long M = 1_000_000_007L;
    int H = scanner.nextInt();
    int W = scanner.nextInt();
    int N = scanner.nextInt();
    Wall[] w = new Wall[N + 2];
    w[0] = new Wall(1, 1);
    for (int i = 1; i <= N; i++) {
      w[i] = new Wall(scanner.nextInt(), scanner.nextInt());
    }
    N++;
    w[N] = new Wall(H, W);

    Arrays.sort(w, Comparator.comparingInt(w2 -> w2.r + w2.c));

    long[] fact = new long[H + W + 1];
    long[] factinv = new long[H + W + 1];
    fact[0] = 1;
    for (int i = 0; i < H + W; i++) fact[i + 1] = fact[i] * (i + 1) % M;
    factinv[0] = 1;
    for (int i = 1; i <= H + W; i++) factinv[i] = factinv[i - 1] * inverse(i, M) % M;

    long[][] dp = new long[N + 1][2];
    dp[0][0] = 1;
    for (int i = 1; i <= N; i++) {
      for (int j1 = 0; j1 < 2; j1++) {
        int j2 = 1 - j1;
        for (int k = 0; k < i; k++) {
          int dr = w[i].r - w[k].r;
          int dc = w[i].c - w[k].c;
          dp[i][j1] += dp[k][j2] * comb(fact, factinv, dr + dc, dr, M) % M;
          if (dp[i][j1] >= M) dp[i][j1] -= M;
        }
      }
    }

    long res = dp[N][1] - dp[N][0];
    if (res < 0) res += M;
    System.out.println(res);
  }

  private static long comb(long[] fact, long[] factinv, int n, int k, long M) {
    if (k < 0) return 0;
    if (n < k) return 0;
    long res = fact[n] * factinv[n - k] % M;
    res *= factinv[k];
    res %= M;
    return res;
  }

  public static long inverse(long a, long mod) {
    return modpow(a, mod - 2, mod);
  }

  public static long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
      if (n % 2 == 1) res = (res * a) % mod;
      a = (a * a) % mod;
      n >>= 1;
    }
    return res % mod;
  }

  private static class Wall {
    public final int r;
    public final int c;

    private Wall(int r, int c) {
      this.r = r;
      this.c = c;
    }
  }
}


Measured memory_bytes: 38300
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string n;
    cin>>n;
    for(int i=0;i<=n.size();i++)
    {
        if(n[i]=='C')
        {
            for(int j=i;j<=n.size();j++)
            {
                if(n[j]=='F')   
                {
                    cout<<"Yes"<<endl;
                	return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] ans=new int[4];
		for(int j=0;j<4;j++) ans[j]=0;
		String cate="null";
		int num=0; 
		for(int i=0;i<N;i++){
			String s=sc.next();
			if(s.equals("G")) ans[0]=1;
			else if(s.equals("W")) ans[1]=1;
			else if(s.equals("P")) ans[2]=1;
			else if(s.equals("Y")) ans[3]=1;
		}

		for(int j=0;j<4;j++){
			if(ans[j]==1) num++;
		}
		
		if(num==3) cate="Three";
		else if(num==4) cate="Four";

		System.out.println(cate);
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void solve(long long N, std::vector<long long> A){
    vector<vll> dp(N+1, vll(3, -INF));
    dp[1][1] = 0; dp[1][2] = A[0];
    dp[2][0] = 0; dp[2][1] = max(A[0], A[1]); dp[2][2] = -INF;
    for(ll i = 3; i <= N; i++){
        for(ll j = (i/2)-1; j <= (i+1)/2; j++){
            if(j-1-((i-2)/2-1) >= 0 && j > 0)
                dp[i][j - ((i/2)-1)] = max(dp[i-1][j - ((i-1)/2-1)], dp[i-2][j-1-((i-2)/2-1)] + A[i-1]);
            else 
                dp[i][j - ((i/2)-1)] = dp[i-1][j - ((i-1)/2-1)];
        }
    }
    cout<< dp[N][1] <<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 15320
#include "vector"
#include "set"
#include "map"
#include "unordered_set"
#include "unordered_map"
#include "string"
#include "iostream"
#include "algorithm"
#include "queue"

using namespace std;

#define ll long long
#define INF 2e9
#define INF2 4611686018427387904
//#define MOD 1000000007
#define MOD 998244353
#define MAX_SIZE 1000000000

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) { bool first = true; for (const auto& j: v) { if (!first) { os << " "; } first = false; os <<j; } os << "\n"; return os; }
template<typename T>
istream& operator>>(istream& is, vector<T>& v) { for (auto& elem : v) { is >> elem; } return is; }

vector<ll> f;
void set_f(int n) { f.resize(n+1); f[0] = 1; for (int i=1; i<= n; i++) { f[i] = (f[i-1] * i) % MOD;} }
ll nod(ll a, ll b) { if (b == 0) { return a; } else { return nod(b, a % b); } }
ll pw(ll x, ll n, ll m=MOD) { if (n == 0) { return 1;} if (n%2 == 0) { return pw((x*x) % m, n/2, m); } return (pw(x, n-1, m) * x) % m; }
ll dv(ll a, ll b) { return (a * pw(b, MOD - 2)) % MOD; }
ll c_n_k(int n, int k) { if (k > n) { return 0; } if (k < 0) { return 0; } return dv(dv(f[n], f[k]), f[n-k]); }

void solve() {
    int n, m;
    cin >> n >> m;

    vi h(n);
    cin >> h;

    vector<vi> g(n+1);
    for (int i=0; i<m; i++) {
        int x, y;
        cin >> x >> y; x--; y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    int ans = 0;
    for (int x=0; x<n; x++) {
        bool f = true;
        for (int y : g[x]) {
            if (h[y] >= h[x]) {
                f = false;
                break;
            }
        }

        if (f) {
            ans++;
        }
    }

    cout << ans;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    if (0) {
        int tests;
        cin >> tests;
        for (int t = 1; t <= tests; t++) {
            //cout << "Case #" << t << ": ";
            solve();
            //cout << "\n";
        }
    } else {
        solve();
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 8704
#include <iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	double x1,x2,x3,x4,y1,y2,y3,y4,a,b,c,d;
	for (n;n>0;n--) {
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 ;
	a=x2-x1; b=y2-y1; c=x4-x3; d=y4-y3;
	if (a==0 || c==0) if (a==0 && c==0) cout << "YES"; else cout << "NO";
	else if (b/a==d/c) cout << "YES"; else cout << "NO";
	cout << endl;
	}
	return 0;
	}

Measured memory_bytes: 1228
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		int N = GetInt();
		long C = GetLong();
		long[] x = new long[N];
		long[] y = new long[N];
		long[] v = new long[N];
		long[] u = new long[N];
		for(int i = 0; i < N; i++)
		{
			x[i] = GetLong();
			v[i] = GetLong();

			y[N - 1 - i] = C - x[i];
			u[N - 1 - i] = v[i];
		}

		Console.WriteLine(Math.Max(cw(N, C, x, v), cw(N, C, y, u)));
	}

	private static long cw(int N, long C, long[] x, long[] v)
	{
		long[] vSum = new long[N + 1];
		for(int i = 0; i < N; i++)
			vSum[i + 1] = vSum[i] + v[i];

		long[] preMax = new long[N + 1];
		for(int i = 0; i < N; i++)
			preMax[i + 1] = Math.Max(preMax[i], vSum[i + 1] - 2 * x[i]);

		long res = 0;
		for(int i = 0; i < N; i++)
		{
			long tmp = vSum[N] - vSum[i] - (C - x[i]);
			res = Math.Max(res, preMax[i] + tmp);
		}

		return res;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 21316
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    a,b,c,d=MI()
    print(max(min(b,d)-max(a,c),0))

main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long x, n, ans=0;
	cin>>x>>n;
	if(n==0){
		ans=x;
	}long long p[n];
	for(long long i=0;i<n;i++){
		cin>>p[i];
	}sort(p,p+n);
	long long ti=0;
	for(long long i=0;i<n;i++){
		if(p[i]==x){
			ti=i;
			break;
		}else if(p[i]>x||i==(n-1)){
			ans=x;
			break;
		}
	}if(ti>0){
		long long temp1=0, temp2=0;
		for(long long i=1;i<=ti;i++){
			if(p[ti-i]!=(x-i)){
				temp1=x-i;
				break;
			}
		}if(temp1==0){
			temp1=p[0]-1;
		}for(long long i=1;(ti+i)<n;i++){
			if(p[ti+i]!=(x+i)){
				temp2=x+i;
				break;
			}
		}if(temp2==0){
			temp2=p[n-1]+1;
		}if((x-temp1)>(temp2-x)){
			ans=temp2;
		}else{
			ans=temp1;
		}
	}cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int coun[105][105][105]={};
vector<int>x,y,z;
int main()
{
  int n,m;
  scanf("%d %d",&n,&m);
  int a[55],b[55],c[55],d[55],e[55],f[55];
  for(int i=0;i<n;i++)
    {
      scanf("%d %d %d %d %d %d",&a[i],&b[i],&c[i],&d[i],&e[i],&f[i]);
       x.push_back(a[i]);
       x.push_back(d[i]);
       y.push_back(b[i]);
       y.push_back(e[i]);
       z.push_back(c[i]);
       z.push_back(f[i]);
    }
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  sort(z.begin(),z.end());
  x.erase(unique(x.begin(),x.end()),x.end());
  y.erase(unique(y.begin(),y.end()),y.end());
  z.erase(unique(z.begin(),z.end()),z.end());
  for(int i=0;i<n;i++)
    {
      int r1=lower_bound(x.begin(),x.end(),a[i])-x.begin();
      int r2=lower_bound(x.begin(),x.end(),d[i])-x.begin();
      int r3=lower_bound(y.begin(),y.end(),b[i])-y.begin();
      int r4=lower_bound(y.begin(),y.end(),e[i])-y.begin();
      int r5=lower_bound(z.begin(),z.end(),c[i])-z.begin();
      int r6=lower_bound(z.begin(),z.end(),f[i])-z.begin();
      for(int i=r1;i<r2;i++)
	{
	  for(int j=r3;j<r4;j++)
	    {
	      for(int k=r5;k<r6;k++)
		{
		  coun[i][j][k]++;
		}
	    }
	}
    }
  long long ans=0;
  for(int i=0;i<=100;i++)
    {
      for(int j=0;j<=100;j++)
	{
	  for(int k=0;k<=100;k++)
	    {
	      if(coun[i][j][k]>=m)
		{
		  long long s1=(x[i+1]-x[i]),s2=(y[j+1]-y[j]),s3=(z[k+1]-z[k]);
		  ans+=s1*s2*s3;
		}
	    }
	}
    }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 5060
ans = []

while True:
    n = int(input())
    if n == 0:
        break
    a = sorted(list(map(int, input().split())))
    min_ = a[-1]
    for i in range(1, n):
        min_ = min(min_, a[i] - a[i-1])
    ans.append(min_)

for i in ans:
    print(i)



Measured memory_bytes: 5648
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
bool ispal(string a)
{
    long long int n=a.length();
    if(n==1)
        return true;
    else{
    int i=0,j;
    j=n-1;
    while(1)
    {
        if(a[i]!=a[j])
        {
            cout<<i<<" "<<j;
           return false;
        }
        i++,j--;
        if(i==j)
         {
        //     cout<<i<<" ";
             break;
        }
    }
    return true;
}}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin>>n;
    vector<pair<ll,ll> >v(n);
    for(int i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        v[i]={a,b};
    }
    sort(v.begin(),v.end());
    double tm=0;
    do{
        for(int i=0;i<n-1;i++)
        {
            ll x1=v[i].first,x2=v[i+1].first,y1=v[i].second,y2=v[i+1].second;
            double dis = sqrt(((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2)));
            tm+=dis;
        }
    }
    while(next_permutation(v.begin(),v.end()));
    ll tp=1;
 for(int i=1;i<n;i++)
 {
     tp*=i+1;
 }
    cout<<std::fixed<<setprecision(10)<<tm /(tp);
  }


Measured memory_bytes: 3760
#include <stdio.h>

#define N 50

int main() {
	static char s[N][N + 1], t[N][N + 1];
	int h, w, i, j, cnt;

	scanf("%d%d", &h, &w);
	for (i = 0; i < h; i++)
		scanf("%s", s[i]);
	for (i = 0; i < h; i++)
		for (j = 0; j < w; j++)
			if (s[i][j] == '#')
				t[i][j] = '#';
	cnt = 0;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++)
			if (s[i][j] == '.') {
				if (i > 0 && s[i - 1][j] == '#')
					cnt++;
				if (i + 1 < h && s[i + 1][j] == '#')
					cnt++;
				if (j > 0 && s[i][j - 1] == '#')
					cnt++;
				if (j + 1 < w && s[i][j + 1] == '#')
					cnt++;
				if (i > 0 && j > 0 && s[i - 1][j - 1] == '#')
					cnt++;
				if (i > 0 && j + 1 < w && s[i - 1][j + 1] == '#')
					cnt++;
				if (i + 1 < h && j > 0 && s[i + 1][j - 1] == '#')
					cnt++;
				if (i < h && j < w && s[i + 1][j + 1] == '#')
					cnt++;
				t[i][j] = cnt + '0';
				cnt = 0;
			}
	}
	for (i = 0; i < h; i++)
		printf("%s\n", t[i]);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int prime[MAX];
bool isprime[MAX];

int sieve(int n){
	int p = 0;
	for(int i=0; i<=n; i++) isprime[i] = true;
	isprime[0] = isprime[1] = false;
	for(int i=2; i<=n; i++){
		if(isprime[i]){
			prime[p++] = i;
			for(int j=2*i; j<=n; j+=i) isprime[j] = false;
		}
	}
	return p;
}

int main(){
	sieve(303030);
	vl sum(303030,0);
	REP(i,1,300000) sum[i] = sum[i-1] + isprime[i];
	while(1){
		int n; cin >> n;
		if(!n) break;
		cout << sum[2*n] - sum[n] << endl;
	}
}


Measured memory_bytes: 5288
n = int(input())
s = [input() for _ in range(n)]
a = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for i in a:
    mi = 50
    for j in s:
        mi = min(mi, j.count(i))
    cnt.append(mi)
ans = ""
for i in range(26):
    ans += a[i] * cnt[i]
print(ans)


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

vector<ll> divisor(ll n){
    vector<ll> D;
    D.push_back(n);
    for(int i=2;i*i<n+1;i++){
        if(n%i==0){
            D.push_back(i);
            D.push_back(n/i);
        }
    }
    sort(D.begin(),D.end());
    return D;
}

int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    ll sum=0;
    rep(i,n) {
        cin>>a[i];
        sum+=a[i];
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    /** sumの約数の列挙 **/
    vector<ll> div = divisor(sum);

    vector<ll> b(n),lsum(n+2,0),rsum(n+2,0);
    ll ans  = 1;
    for(auto d: div){
        rep(i,n){
            b[i]=a[i]%d;
        }
        sort(b.begin(),b.end());

        REP(i,n){
            lsum[i]=lsum[i-1]+b[i-1];
            rsum[n-i+1] =d-b[n-i]+rsum[n-i+2];
        }
        ll tk=1e15;
        REP(i,n){
            if(lsum[i]==rsum[i+1]){
                    tk=lsum[i];
                    break;
            }
        }
        if(tk<=k)  ans=max(ans,d);
    }
    cout<<ans<<endl;
    return 0;    
}

Measured memory_bytes: 3600
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cmath>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <unordered_map>
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define ll long long
#define INF ((1<<30)-1)
#define NEG (-1)
#define MOD 1000000007
#define MAXN 100100
#define EPS 1e-9
#define INFLL 1e18
using namespace std;
FILE *in,*out;

int N,M,K;
int used[250];

int read()
{
    int i,j,k,t,z;
    fscanf(in,"%d",&N);
    int ans =0;
    for(i=2;i<=N;i++)
    {
        if(i%2==0)
            continue;
        j = i;
        z=1;
        for(k=2;k<=j;k++)
        {
            t=0;
            while(j%k==0)
            {
                j/=k;
                t++;
            }
            z *= (t+1);
        }
        // printf("%d %d\n",i,z);
        if(z==8)
            ans ++;
    }
    printf("%d\n",ans);
        
    return 0;
}

int main()
{
    // in = fopen("A.in","r");
    // out  = fopen("A.out","w");
    in = stdin;
    out = stdout;
    read();
    return 0;
}
//////////// Local Snippets
// forx
// fory
// vectorx
// pairx
// sizex

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 5e5+5;
priority_queue<pair<long long,long long>> pq;
long long ans;
long long tot;
int main(){
    long long X,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
   
    for(long long i=1;i<=A;i++){
         long long x;
        cin>>x;
        pq.push(make_pair(x,1));
    }
    for(long long i=1;i<=B;i++){
        long long x;
        cin>>x;
        pq.push(make_pair(x,2));
    }
    for(long long i=1;i<=C;i++){
        long long x;
        cin>>x;
        pq.push(make_pair(x,3));
    }
    while(!pq.empty()){
        auto hold = pq.top();
        long long val = hold.first;
        long long typ = hold.second;
        
        pq.pop();
        if(typ==1 && X){
            ans+=val;
            X--;
            if(tot==(X+Y)){
                break;
            }
        }else if(typ==2 && Y){
            ans+=val;
            Y--;
            if(tot==(X+Y)){
                break;
            }
        }else if(typ ==3){
            ans+=val;
            tot++;
            if(tot==(X+Y)){
                break;
            }
        }

    }
    cout<<ans<<endl;
}

Measured memory_bytes: 10604
public class Main {
	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		var a = sc.nextBigInteger();
		var b = sc.nextBigInteger();
		var c=sc.nextBigInteger();
		var d = sc.nextBigInteger();
		var ac = a.multiply(c);
		var ad = a.multiply(d);
		var bd = b.multiply(d);
		var bc = b.multiply(c);
		System.out.println(ad.max(ac.max(bc.max(bd))));
	}
}


Measured memory_bytes: 35924
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>

int main(){
  int N;

  std::cin >> N;

  std::vector<int> A{};
  A.reserve(N);
  std::copy_n(std::istream_iterator<int>(std::cin),N,std::back_inserter(A));

  std::sort(A.begin(),A.end());
  auto n = std::distance(A.begin(),std::unique(A.begin(),A.end()));
  
  if(!(n & 1)){ --n; }

  std::cout << n << std::endl;
  
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  ll N;
  cin >> N;

  ll ans = N * (N - 1) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), S = cin.getStr();
    let L = new Array(N);//E
    let s = 0;
    for (let n = 0; n < N; n++) {
        s = L[n] = s + (S[n] == 'E' ? 1 : 0);
    }
    let R = new Array(N);//W
    s = 0;
    for (let n = N-1; n >= 0; n--) {
        s = R[n] = s + (S[n] == 'W' ? 1 : 0);
    }
    let ans = 1e6;
    for (let n = 0; n < N; n++) {
        let w = (L[N-1] - L[n]) + (R[0] - R[n]);
        if (ans > w) ans = w;
    }
    console.log(ans);
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 12236
#include <stdio.h>

int main(void)
{
	int sum, sum2, money, num, i;
	double avg;
	
	sum = i = 0;
	while (scanf("%d%*c%d", &money, &num) != EOF){
		sum += money * num;
		sum2 += num;
		i++;
	}
	
	avg = sum2 * 1.00 / i;
	if ((int)(avg * 10) % 10 >= 5){
		avg = (avg * 10 + 5) / 10;
	}
	
	printf("%d\n%.f\n", sum, avg);
	
	return (0);
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
    string str,str2;
    cin >> str;
    int n = str.size();
    for(int i = 0;i < n;i++){
        str2.push_back(str[n-i-1]);
    }
    cout << str2 << endl;
    return 0;
}


Measured memory_bytes: 3144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();
		int outcome = i%2 == 0? i : i*2;
		System.out.println(outcome);
		
	}

}


Measured memory_bytes: 23636
import statistics
import math

n = int(input())
A = []
B = []
for _ in range(n):
    a, b = map(int,input().split())
    A.append(a)
    B.append(b)

A_m = statistics.median(A)
B_m = statistics.median(B)
if n%2 == 1:
    num = B_m - A_m +1
elif n %2 ==0:
    num = 2*B_m - 2*A_m +1
print(int(num))

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

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

// https://kamino.hatenablog.com/entry/cpp-permutation-combination
void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}


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

    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i]--;
    vector<int> b(n);
    rep(i, n) cin >> b[i];
    rep(i, n) b[i]--;

    int count = 0;
    int start;
    int end;
    foreach_permutation(n, [&](int *indexes) {
        count++;
        bool ok1 = [&] {
            rep(i, n) {
                if (indexes[i] != a[i]) {
                    return false;
                }
            }
            return true;

        }();
        if (ok1) {
            start = count;
        }
        bool ok2 = [&] {
            rep(i, n) {
                if (indexes[i] != b[i]) {
                    return false;
                }
            }
            return true;
        }();
        if (ok2) {
            end = count;
        }
    });

    cout <<abs(end - start) << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<tuple>
#include<set>
#include<map>
#include<cctype>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e16;
const int MOD = 1e9 + 7;


ll N,K,h[100005];


int main(void) {
	cin >> N>>K;
	FOR(i, 0, N)cin >> h[i];
	sort(h, h + N); ll ans = INF;
	for (int i = 0; i + K-1 < N; i++) {
		ans = min(ans, h[i + K-1] - h[i]);
	}
	ct(ans);
	return 0;
}

Measured memory_bytes: 1024
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{d: usize, t: usize, s: usize}

    if (d + t - 1) / t <= s {
        println!("Yes");
    } else {
        println!("No");
    }
    
    println!("", );
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC126B()
{
	string S;
	cin >> S;
	int a = stoi(S.substr(0, 2));
	int b = stoi(S.substr(2, 2));
	bool a1 = false;
	bool b1 = false;
	if (0 < a && a <= 12)
	{
		a1 = true;
	}
	if (0 < b && b <= 12)
	{
		b1 = true;
	}
	if (a1 && b1)
	{
		cout << "AMBIGUOUS" << endl;
	}
	if (a1 && !b1)
	{
		cout << "MMYY" << endl;
	}
	if (!a1 && b1)
	{
		cout << "YYMM" << endl;
	}
	if (!a1 && !b1)
	{
		cout << "NA" << endl;
	}
}
int main()
{
	ABC126B();
	return 0;
}

Measured memory_bytes: 256
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(i);
    i %= 10;
    if (i == 0 || i == 1 || i == 6 || i == 8) {
        cout << "pon" << endl;
    } else if (i == 3) {
        cout << "bon" << endl;
    } else {
        cout << "hon" << endl;
    }
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
using namespace std;

int pow(int m){
  int _pow=1;
  for(int i=0; i<m; i++) _pow*=10;
  return _pow;
}

int main(){
  int n; 
  auto dmy=scanf("%d", &n);
  
  int ans=0;
  for(int i=0; i<6; i++){
    int digid=pow(i);
    if(n>=digid){
      if(i%2==0){
        if(n<pow(i+1)){
          ans += n-digid+1;
        }else{
          ans += pow(i+1)-digid;
        }
      }
    }
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000;

/* typedef */

struct Cstmr {
  int m, l, k;
};

/* global variables */

int n, tt;
Cstmr cs[MAX_N];
int ons[MAX_N + 2];
bool used[MAX_N];

/* subroutines */

bool simulate(int on) {
  memset(ons, 0, sizeof(ons));
  ons[0] = on;
  memset(used, 0, sizeof(used));

  int nu = n;
  
  for (int t = 0; t < tt; t++) {
    for (int i = 0; ons[t] > 0 && i < n; i++)
      if (! used[i] && t % (cs[i].l + cs[i].k) <= cs[i].l) {
	int t0 = t + cs[i].m;
	if (t0 > tt) return false;
	used[i] = true;
	if (! --nu) return true;
	ons[t0]++;
	ons[t]--;
      }
    ons[t + 1] += ons[t];
  }
  
  return (nu == 0);
}

/* main */

int main() {
  for (;;) {
    cin >> n >> tt;
    if (n == 0) break;

    for (int i = 0; i < n; i++)
      cin >> cs[i].m >> cs[i].l >> cs[i].k;

    int m;
    for (m = 1; m <= n; m++)
      if (simulate(m)) break;

    cout << m << endl;
  }

  return 0;
}

Measured memory_bytes: 1176