akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define lli long long int
#define pii pair<int,int>
#define vii vector<pii>
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v)  v.begin(),v.end()
#define mod 1000000007
#define vi vector<int>
#define vl vector<lli>
#define vll vector<pair<lli,lli>>
#define pll pair<lli,lli>
#define vvi vector<vector<int>>
#define vvl vector<vector<lli>>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define tk(args...) take(args);
#define posLSB(X) __builtin_ctz(X)
#define num1bit(X) __builtin_popcount(X)
#define numlead0(X) __builtin_clz(X)
#define umreserve(X) X.reserve(32768); X.max_load_factor(0.25);
void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; err(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template<class T>
void printvec(vector<T> &a){
	for(T &x:a){
		cout<<x<<" ";
	}
	cout<<endl;
}
template<class T>
void printarr(T a[],lli n){
	for(lli i=0;i<n;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};

#define endl "\n"

lli add(lli a, lli b) {
	a += b;
	if (a >= mod) a -= mod;
	return a;
}

lli mul(lli a, lli b) {
	return a * 1ll * b % mod;
}

inline bool setmin(lli &x, lli y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(lli &x, lli y) { return (y > x) ? x = y, 1 : 0; }

lli power_mod(lli a,lli x){if(x==0) return 1;lli y=power_mod(a,x/2);lli ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
lli inv(lli a){return power_mod(a,mod-2);}
lli power(lli a, lli x){ if(x==0) return 1; lli y= power(a,x/2); lli ans=(y*y); if(x%2) ans*=a; return ans;}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli n;
	cin>>n;
	vector<lli> a(n);
	for(lli i=0;i<n;i++){
		cin>>a[i];
	}
	vector<lli> dp(n);
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(lli i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1]<<endl;

}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;

public class Main {

	public static void main(String[] args) {
		try {
			InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			int num = Integer.parseInt((br.readLine()));
			String[] stringArr = br.readLine().split(" ");
			Integer[] intArr = new Integer[num];
			int answer = 0;

			for (int i = 0; i < intArr.length; i++) {
				intArr[i] = Integer.valueOf(stringArr[i]);
			}

			Arrays.sort(intArr, Collections.reverseOrder());

			for (int i = 0; i < intArr.length; i++) {
				if (i % 2 == 0) {
					answer += intArr[i];
				} else {
					answer -= intArr[i];
				}
			}

			System.out.println(answer);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 32700
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  int res = 0;
  rep(i, n) {
    if (s[i] == '(') res++;
    else {
      if (res == 0) cout << '(';
      else res--;
    }
  }
  cout << s;
  rep(i, res) cout << ')';
  cout << endl;


  
  return 0;
}

Measured memory_bytes: 256
from itertools import product


def violates(w_flags):
    prev_flag = w_flags[0]
    for flag in w_flags[1:]:
        if flag and prev_flag:
            return True
        prev_flag = flag
    return False


H, W, K = [int(elem) for elem in input().split()]
MOD = 10**9 + 7

if W == 1:
    print(1)
    exit(0)

dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1

for h in range(1, H + 1):
    for w_flags in product((False, True), repeat=W-1):
        if violates(w_flags):
            continue
        for w in range(W):
            if w == 0:
                if w_flags[0]:
                    dp[h][0] += dp[h - 1][1]
                else:
                    dp[h][0] += dp[h - 1][0]
            elif w == W - 1:
                if w_flags[W - 2]:
                    dp[h][W - 1] += dp[h - 1][W - 2]
                else:
                    dp[h][W - 1] += dp[h - 1][W - 1]
            else:
                if w_flags[w - 1] == True:
                    dp[h][w] += dp[h - 1][w - 1]
                elif w_flags[w] == True:
                    dp[h][w] += dp[h - 1][w + 1]
                else:
                    dp[h][w] += dp[h - 1][w]
            dp[h][w] %= MOD

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


Measured memory_bytes: 3064
import java.util.*;

class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int charge = 0;
        if (N % 1000 == 0) {
            charge = 0;
        } else {
            charge = 1000 - (N % 1000);
        }
        
        System.out.println(charge);
    }
}

Measured memory_bytes: 35512
#include<stdio.h>
#include<stdlib.h>
int main(){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(abs(b-a)<=d&&abs(c-b)<=d||abs(c-a)<=d) printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	ll q , h , s , d;
	cin >> q >> h >> s >> d;
	
	int n;
	cin >> n;
	
	ll one = min(4 * q , min(2 * h , s));
	
	ll two = min(2 * one , d);
	
	ll ans = (n & 1 ? one : 0ll);
	if(n & 1)--n;
	ans += two * (n / 2);
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
import numpy as np
import itertools
import math
N = int(input())
place = np.zeros((N, 2))
for i in range(N):
  x, y = map(int, input().split())
  place[i,:] = [x,y]
length = np.zeros((N, N))
for i in range(N):
  a = np.array(place[i,:])
  for j in range(i,N):
    b = np.array(place[j,:])
    length[j,i] = length[i,j] = np.linalg.norm(b-a)

s = np.zeros(math.factorial(N))
for i,order in enumerate(list(itertools.permutations(list(range(N))))):
  for j in range(N-1):
    s[i] += length[order[j], order[j+1]]
    
print(np.mean(s))

Measured memory_bytes: 22284
#include<cstdio>
#include<cstring>
int main()
{
	int i,n;
	char a[100005],b[100005];
	gets(a);
	n=strlen(a);
	for(i=0;i<n;i++)
	b[n-i-1]=a[i];
	for(i=0;i<n;i++)
	{
		if(b[i]=='b')
		{
			b[i]='d';
			continue;
		}
		if(b[i]=='d')
		{
			b[i]='b';
			continue;
		}
		if(b[i]=='q')
		{
			b[i]='p';
			continue;
		}
		if(b[i]=='p')
		{
			b[i]='q';
			continue;
		}
	}
	b[n]='\0';
	if(strcmp(a,b)==0)
	printf("Yes");
	else
	printf("No");
	return 0;
}

Measured memory_bytes: 384
import java.util.*

fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val n = sc.nextInt()
    val m: Long = sc.nextLong() * 2
    val a = sc.asSequence().take(n).map { it.toLong() }.toList()

    val c: Long = a.reduce { acc, v -> lcm(acc, v) }

    if (a.any { (c / it) % 2 == 0L }) {
        print(0)
        return
    }
    var r = 0
    var cc: Long = c
    while (cc <= m) {
//        if (cc % 2 == 1L) {
            r++
//        }
        cc += c * 2
    }
    print(r)
}

fun lcm(a: Long, b: Long): Long {
    var a = a
    var b = b
    var temp: Long
    var c = a
    c *= b
    while (true) {
        temp = a % b
        if (temp == 0L) {
            break
        }
        a = b
        b = temp
    }
    return (c / b)
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll k; cin >> k;
    ll sum = 0;
    for(ll a=1;a<=k;a++){
        for(ll b=1;b<=k;b++){
            for(ll c=1;c<=k;c++){
                sum += gcd(gcd(a, b), c);
            }
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define pr pair<int,int>
	#define FR first
	#define SE second
	#define MP make_pair
	#define PB push_back
	#define vc vector
	#define mid (l+r)/2
	#define lc 2*x
	#define rc 2*x+1
	void chmax(int &x,const ll y) {x=(x>y?x:y);}
	void chmin(int &x,const ll y) {x=(x<y?x:y);}
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) putchar('-'),num=-num;
		if(num>=10) write(num/10);
		putchar('0'+num%10);
	}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	const int INF=0x3f3f3f3f;
	const int MOD=19491001;
	void add(ll &a,ll b){a+=b;if(a>=MOD)a-=MOD;if(a<=-MOD)a+=MOD;}
	ll qpower(ll x,ll e)
	{
		ll ans=1;
		while(e)
		{
			if(e&1) ans=ans*x%MOD;
			x=x*x%MOD;e>>=1;
		}
		return ans;
	}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=1e5+10;

    void main()
	{
		int a=qread(),b=qread(),c=qread();
		write(max(c-(a-b),0));
	}
};
int main()
{
	srand(time(0));
	mine::main();
}


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

Measured memory_bytes: 128
using System;
using System.Linq;
class P{
  static void Main(){
    var s=Console.ReadLine().Split().Select(int.Parse);
  var b=Console.ReadLine().Split().Select(x=>Math.Abs(long.Parse(x)-s.Last()));
    long a=b.First();
    foreach(long x in b){
      var n=new long[]{a,x}.OrderBy(y=>y).ToArray();
      a=n[0];
      while(n[1]%n[0]!=0){
        long i=n[1]%n[0];
        n[1]=n[0];
        n[0]=i;
        a=n[0];
      }
    }
    Console.WriteLine(a);
  }
}

Measured memory_bytes: 26464
package main

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

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

func solve(in io.Reader, out io.Writer) {
	bs := NewBufScanner(in)
	bw := NewBufWriter(out)
	defer bw.w.Flush()
	n := bs.IntScan()
	cards := []int{}
	for i:=0; i<n; i++ {
		cards = append(cards, bs.IntScan())
	}
	sort.Ints(cards)

	alice := 0
	bob := 0
	for i:=n-1; i>=0; i-=2 {
		alice += cards[i]
	}

	for i:=n-2; i>=0; i-=2 {
		bob += cards[i]
	}

	bw.Printf("%v", alice - bob)
}

// BufScanner original scanner
type BufScanner struct {
	s *bufio.Scanner
}

// NewBufScanner constructer
func NewBufScanner(in io.Reader) *BufScanner {
	s := bufio.NewScanner(in)
	s.Buffer(make([]byte, 1024), 1e+9)
	s.Split(bufio.ScanWords)
	return &BufScanner{
		s: s,
	}
}

// Scan Scan Data
func (b *BufScanner) Scan() string {
	b.s.Scan()
	return b.s.Text()
}

// IntScan Scan Data
func (b *BufScanner) IntScan() int {
	v, err := strconv.Atoi(b.Scan())
	if err != nil {
		panic(err)
	}
	return v
}

// BufWriter original writer
type BufWriter struct {
	w *bufio.Writer
}

// NewBufWriter constructer
func NewBufWriter(out io.Writer) *BufWriter {
	w := bufio.NewWriter(out)
	return &BufWriter{
		w: w,
	}
}

// Printf Output file
func (b *BufWriter) Printf(format string, a ...interface{}) {
	fmt.Fprintf(b.w, format, a...)
}

Measured memory_bytes: 640
#include <iostream>
#include<math.h>
using namespace std;

int main()
{
    int A, B, K;

    cin >> A >> B >> K;

    int answer;

    for (int n = min(A, B); n > 0; n--)
    {
        if(A%n == 0 && B%n==0){
            K -= 1;
        }
        if(K==0){
            answer = n;
            break;
        }
    }

    cout << answer << endl;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

#define MAX 110
vector<int> G[MAX];

int fw[MAX][MAX];
bool check(int N,int K) {
  rep(i,N) rep(j,N) fw[i][j] = INT_MAX;
  rep(i,N) fw[i][i] = 0;
  rep(i,N) {
    rep(j,(int)G[i].size()) {
      fw[i][G[i][j]] = 1;
      fw[G[i][j]][i] = 1;
    }
  }
  rep(k,N) rep(i,N) rep(j,N) {
    if( fw[i][k] == INT_MAX || fw[k][j] == INT_MAX ) continue;
    fw[i][j] = min(fw[i][j],fw[i][k]+fw[k][j]);
  }
  int cnt = 0;
  rep(i,N) {
    REP(j,i+1,N) {
      if( fw[i][j] == 2 ) ++cnt;
    }
  }
  //cout << "cnt = " << cnt << ", K = " << K << endl;
  return cnt == K;
}

int main() {
  int N,K;
  cin >> N >> K;
  /*
  if( K < N - 2 ) {
    puts("-1");
    return 0;
  }
  if( N > 2 && N == K ) {
    cout << N << endl;
    rep(i,N) {
      int s = i, t = ( i + 1 ) % N;
      cout << s + 1 << " " << t + 1 << endl;
    }
    return 0;
  }
  */
  int n = N - 1;
  /*
  if( K > (int)(n*(n-1)/2) ) {
    puts("-1");
    return 0;
  }
  */
  REP(i,1,N) {
    G[0].pb(i);
  }
  typedef pair<int,int> ii;
  int sum = n * (n-1) / 2;
  int diff = sum - K;
  REP(i,1,N) {
    REP(j,i+1,N) {
      if( diff <= 0 ) break;
      G[i].pb(j);
      --diff;
    }
    if( diff <= 0 ) break;
  }

  
  set<ii> S;
  rep(i,N) {
    rep(j,(int)G[i].size()) {
      if( i < G[i][j]) {
	S.insert(ii(i,G[i][j]));
      }
    }
  }

  if( !check(N,K) ) {
    puts("-1");
    return 0;
  }
  
  cout << S.size() << endl;
  for(auto v : S) {
    cout << v.fst + 1 << " " << v.snd + 1 << endl;
  }


  
  return 0;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    static final Scanner sc    = new Scanner(System.in);
    static final int     MOD   = (int) 1E9 + 7;
    static final long    INF_L = (long) 4E18;
    
    public static void main(String[] args) {
        List<String> list = Arrays.asList("SUN","MON","TUE","WED","THU","FRI","SAT");
        String s = nstr();
        System.out.println(7 - list.indexOf(s));
    }
        

    @Deprecated
    static int nint() {
        return sc.nextInt();
    }

    @Deprecated
    static int[] nints(int N) {
        return nints(0, N, 0);
    }

    @Deprecated
    private static int[] nints(int padL, int N, int padR) {
        int[] a = new int[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nint();
        return a;
    }

    static long nlong() {
        return sc.nextLong();
    }

    static long[] nlongs(int N) {
        return nlongs(0, N, 0);
    }

    static long[] nlongs(int padL, int N, int padR) {
        long[] a = new long[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nlong();
        return a;
    }

    static double ndouble() {
        return sc.nextDouble();
    }

    static double[] ndoubles(int N) {
        return ndoubles(0, N, 0);
    }

    static double[] ndoubles(int padL, int N, int padR) {
        double[] d = new double[N + padL + padR];
        for (int i = 0; i < N; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    static String nstr() {
        return sc.next();
    }

    static char[] nchars() {
        return sc.next().toCharArray();
    }

    static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    static char[][] nchars2(int H, int W) {
        return nchars2(H, W, 0, 0);
    }

    static char[][] nchars2(int H, int W, int padLU, int padRD) {
        char[][] a2 = new char[H + padLU + padRD][W + padLU + padRD];
        for (int i = 0; i < H; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, W);
        return a2;
    }

    static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    static long abs(long a) {
        return Math.abs(a);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define For(i, l, r) for(int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
    int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
    return x * fh;
}

void File() {
#ifdef zjp_shadow
	freopen ("D.in", "r", stdin);
	freopen ("D.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3;
int len; char str[N];

int main () {
	File();
	scanf ("%s", str + 1);
	len = strlen(str + 1);
	For (i, 2, len)
		if (str[i - 1] == str[i + 1]) return printf ("%d %d\n", i - 1, i + 1), 0;
		else if(str[i - 1] == str[i]) return printf ("%d %d\n", i - 1, i), 0;
	puts("-1 -1");
    return 0;
}


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

vector<vector<int>> g;
vector<int> col;

bool dfs(int v, int c) {
  col[v] = c;
  for (auto a : g[v]) {
    if (col[a] != -1) {
      if (col[a] == c) return false;
      continue;
    }
    if (!dfs(a, 1 - c)) return false;
  }
  return true;
}

int main() {
  ll n, m;
  cin >> n >> m;
  g.resize(n, vector<int>());
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  col.assign(n, -1);
  ll ans = 0;
  if (dfs(0, 0)) {
    ll cnt = 0;
    rep(i, n) if (col[i] == 0) cnt++;
    ans = cnt * (n - cnt) - m;
  }
  else {
    ans = n * (n - 1) / 2 - m;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9496
/**
 * ******* Created on 27/10/19 5:23 PM*******
 */

import java.io.*;
import java.util.*;

public class Main implements Runnable {

    private void solve() throws IOException {
        int a = reader.nextInt();
        int b = reader.nextInt();
        if(a >=1 && a<= 9 && b >=1 && b<=9)
            writer.println(a*b);
        else
            writer.println("-1");
    }

    public static void main(String[] args) throws IOException {
        try (Input reader = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) {
            new Main().run();
        }
    }

    StandardInput reader;
    PrintWriter writer;

    @Override
    public void run() {
        try {
            reader = new StandardInput();
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    interface Input extends Closeable {
        String next() throws IOException;

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

        default long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        default double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        default int[] readIntArray() throws IOException {
            return readIntArray(nextInt());
        }

        default int[] readIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        default long[] readLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextLong();
            }
            return array;
        }
    }

    private static class StandardInput implements Input {
        private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        private StringTokenizer stringTokenizer;

        @Override
        public void close() throws IOException {
            reader.close();
        }

        @Override
        public String next() throws IOException {
            if (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                stringTokenizer = new StringTokenizer(reader.readLine());
            }
            return stringTokenizer.nextToken();
        }
    }
}


Measured memory_bytes: 24916
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define rep1(i,n) Rep(i,1,n)
#define rep(i,n) Rep(i,0,n-1)
long long n,tmp1,tmp2,tmp3,x,y;
vector <long long> v;
int main(){
	rep(i,10)
		v.pb(i);
	rep1(key,50000){
		x=v[key]*10;
		y=v[key]%10;
		tmp1=x+y-1;
		tmp2=x+y;
		tmp3=x+y+1;
		if(y!=0)
			v.pb(tmp1);
		v.pb(tmp2);
		if(y!=9)
			v.pb(tmp3);
	}
	cin>>n;
	cout<<v[n]<<endl;
	return 0;
} 

Measured memory_bytes: 2420
#include <cstdio>

using namespace std;

int main()
{
	int a,b,c,rh=0,re=0;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(a*a+b*b==c*c){
			re++;
		}
		else if(a==b){
			rh++;
		}
	}
	printf("%d\n",re);
	printf("%d\n",rh);
	
	return 0;
}

Measured memory_bytes: 0
import itertools
N,M,R=map(int,input().split())
r=[int(i)-1 for i in input().split()]
P=[set() for i in range(N)]
for i in range(M):
    A,B,C=map(int,input().split())
    P[A-1].add((B-1,C))
    P[B-1].add((A-1,C))
p=[[0 for i in range(R)] for i in range(R)]
def dijkstra(s):
    d=[10**9 for i in range(N)]
    d[s]=0
    Q=set(range(N))
    while(len(Q)>0):
        u=list(Q)[0]
        for v in Q:
            if d[v]<d[u]:
                u=v
        Q-=set([u])
        for v in P[u]:
            if d[v[0]]>d[u]+v[1]:
                d[v[0]]=d[u]+v[1]
    return d
for i in range(R):
    L=dijkstra(r[i])
    for j in range(R):
        p[i][j]=L[r[j]]
S=list(itertools.permutations(range(R),R))
ans=10**9
for sg in S:
    tmp=0
    for i in range(R-1):
        tmp+=p[sg[i]][sg[i+1]]
    if tmp<ans:
        ans=tmp
print(ans)


Measured memory_bytes: 57816
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
    while(1) {
        int N, T;
        cin >> N >> T;
        if (N == 0 && T == 0) break;
        vector<int> P(N);
        for (int i = 0; i < N; i++) {
            cin >> P[i];
        }

        vector<int> PP;
        PP.push_back(0);
        for (int i = 0; i < N; i++) {
            PP.push_back(P[i]);
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                PP.push_back(P[i] + P[j]);
            }
        }

        sort(PP.begin(), PP.end());

        int ans = 0;
        for (int i = 0; i < PP.size(); i++) {
            int k = upper_bound(PP.begin(), PP.end(), T - PP[i]) - PP.begin();
            if (k != 0) {
                ans = max(ans, PP[i] + PP[k - 1]);
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

using namespace std;

int main () {
	char s[10086];
	scanf("%s", s);
	int l = strlen(s) - 1;
	if (s[l] == '2' || s[l] == '4' || s[l] == '7' || s[l] == '5' || s[l] == '9') printf("hon\n");
	else if (s[l] == '0' || s[l] == '1' || s[l] == '6' || s[l] == '8') printf("pon\n");
	else printf("bon\n");
	return 0;
}


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

#define int long long

int n;
int dp[55];

int rec(int stage) {
  // 終了条件
  if (stage == 0) {
    return dp[stage] = 1;
  }
  
  // 一度求めた値の場合、メモしたやつを返す
  if (dp[stage] != -1) {
    return dp[stage];
  }

  int ans = 0;

  for (int i = 1; i <= 3; i++) {
    if (stage - i < 0) continue;
    ans += rec(stage - i);
  }

  // 値を求めたらメモる
  return dp[stage] = ans;
}

signed main() {
  // 前処理
  fill(dp, dp+33, -1);
  rec(30);

  while (1) {
    cin >> n;
    if (n == 0) break;
    int ans = (dp[n] + 3650 - 1) / 3650;
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3012
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007
using namespace std;

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

int main(){
    unsigned long long a,b,ans,n,k;

    cin >> a >> b;

    if(a<b)swap(a,b);
    k = gcd(a,b);

    ans = 1;

    n=2;
    if(k%n==0){
        ++ans;
        k /= n;
        while(k%n==0){
             k /= n;
        }
    }
    ++n;
    int kk = sqrt(k);
    for(n=3;kk >= n;n+=2){
        if(k%n==0){
            ++ans;
            k/=n;
            while(k%n==0){
             k /= n;
            }
        }
    }
    if(k!=1)++ans;

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}


Measured memory_bytes: 256
#include <cstdio> 
#include <cstdlib> 
#include <cmath> 
#include <cstring> 
#include <climits> 
#include <cfloat> 
#include <map> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <numeric>
#include <cassert>

#define FOR(i, min, max) for (int i = (min); i < (max); ++i) 
#define FORE(i, min, max) for (int i = (min); i <= (max); ++i) 
#define REP(i, n) for (int i = 0; i < (n); ++i) 
#define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) 
#define FOR_EACH(vec, it) for (typeof((vec).begin()) it = (vec).begin(); it != (vec).end(); ++it)

using namespace std; 
static const double EPS = 1e-12; 
typedef long long ll; 

int main(void)
{
    int A, B, H, M;
    cin >> A >> B >> H >> M;

    long double arcA = (long double)(H*60+M)/(12.0*60.0) * 2.0 * M_PI;
    long double arcB = (long double)M/60.0 * 2.0 * M_PI;

    long double xa = A*cos(arcA);
    long double ya = A*sin(arcA);
    long double xb = B*cos(arcB);
    long double yb = B*sin(arcB);
    long double dx = abs(xa-xb);
    long double dy = abs(ya-yb);
    long double d = sqrt(dx*dx+dy*dy);
    printf("%.20Lf\n", d);
    return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,cnt=0;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
        int m=999999999;
    for(int i=1;i<=n;i++)
    {
        
        m=min(a[i],m);
        if(a[i]<=m)
          {
              cnt++;
           }
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    min_id = 0
    max_id = 10**5
    for _ in range(M):
        L, R = map(int, input().split())
        if min_id < L:
            min_id = L
        if max_id > R:
            max_id = R
    if min_id > max_id:
        print(0)
    else:
        print(max_id - min_id + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73764
A,B,C = map(int,input().split())
K = int(input())

count = 0

for i in range(K+1):
    if C <= B:
        C *= 2
        count += 1
    elif B <= A:
        B *= 2
        count += 1



if count <= K:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9088
#ABC-113-B
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = -1
ans_diff = 10**19

for i in range(N):
    tempe = (T-H[i]*0.006)
    if ans_diff > abs(A - tempe):
        ans_diff = abs(A - tempe)
        ans = i

print(ans+1)

Measured memory_bytes: 3064
# include <iostream>
using namespace std;
string a,b;
int n,m;
void work (void)
{
	int i,j,k,f;
	i=n-m;
	while (i>=0)
	{
		f=1;
		j=i;
		k=0;
		while (k<m)
		{
			if (a[j]!='?'&&a[j]!=b[k])
			{
				f=0;
				break;
			}
			j++;
			k++;
		}
		if (f==1)
		{
			j=i;
			k=0;
			while (k<m)
			{
				a[j]=b[k];
				j++;
				k++;
			}
			for (j=0;j<n;j++)
			if (a[j]=='?')
			a[j]='a';
			break;
		}
		i--;
	}
	if (f==1)
	cout<<a;
else cout<<"UNRESTORABLE";
}
int main (void)
{
	cin>>a;
	cin>>b;
	n=a.size ();
	m=b.size ();
	work ();
	return 0;
}


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

int main(){
  string x, y;
  cin >> x >> y;
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  reverse(y.begin(),y.end());
  
  if (x<y){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

using ll = long long;

ll sum(ll l, ll r, ll len)
{
    ll f = r / 3 - l / 3;
    ll b = r / 5 - l / 5;
    ll fb = r / 15 - l / 15;
    ll other = ((r - l) - (f + b - fb)) * len;

    return other + (f + b - 2 * fb) * 4 + fb * 8;
}

ll c(ll x)
{
    ll p = 1, len = 1;
    ll res = 0;
    while (p * 10 <= x) {
        res += sum(p - 1, p * 10 - 1, len);
        len++;
        p *= 10;
    }
    res += sum(p - 1, x - 1, len);
    return res;
}

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

    ll l = 0, r = n + 1;
    while (r - l > 1) {
        ll mid = (l + r) / 2;
        if (c(mid) < n) {
            l = mid;
        } else {
            r = mid;
        }
    }

    ll st = n - c(l);
    
    string s;
    for (ll i = l; i < l + 100; i++) {
        if (i % 15 == 0) {
            s += "FizzBuzz";
        } else if (i % 3 == 0) {
            s += "Fizz";
        } else if (i % 5 == 0) {
            s += "Buzz";
        } else {
            s += to_string(i);
        }
    }
    cout << s.substr(st - 1, 20) << endl;
    return 0;
}

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

int main(){
  ll N;
  cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i++){
    cin >> S[i];
  }
  ll A=0, W=0, T=0, R = 0;
  for (int i = 0; i<N; i++){
    if (S[i] == "AC") A++;
    if (S[i] == "WA") W++;
    if (S[i] == "TLE") T++;
    if (S[i] == "RE") R++;
  }
  cout << "AC" << ' ' << 'x' << ' '<< A << endl;
  cout << "WA" << ' ' << 'x' <<' '<< W << endl;
  cout << "TLE" << ' ' << 'x' << ' ' << T << endl;
  cout << "RE" << ' '  << 'x' << ' ' <<R << endl;
  return 0;
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define re return
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
int n,m;
string s;
int main() { 
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
  cin>>n>>m;
  m--;
  cin>>s;
  s[m]=s[m]-'A'+'a';
  cout<<s<<endl;
    return 0; 
}

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

const int MaxN=1e5+5;
const int Mod=1e9+7;

int N,Ans=1;
int A[MaxN],Deg[MaxN];
int Pre[MaxN],Cnt[MaxN],F[MaxN];
bool Vis[MaxN];

int main(){
	int i,j,l,l1,l2;
	scanf("%d",&N);
	for(i=1;i<=N;i++)
		scanf("%d",&A[i]),Deg[A[i]]++;
	for(i=1;i<=N;i++){
		if(Deg[i]>2){
			puts("0");
			return 0;
		}
		if(Deg[i]<2||Vis[i])
			continue;
		j=i;
		do{
			if(Vis[j]){
				puts("0");
				return 0;
			}
			Vis[j]=true;
			Pre[A[j]]=j;
			j=A[j];
		}while(i^j);
	}
	for(i=1;i<=N;i++)
		if(!Deg[i]){
			l1=l2=0;
			for(j=i;!Vis[j];j=A[j])
				Vis[j]=true,l1++;
			do j=Pre[j],l2++;
			while(Deg[j]==1);
			if(l1>l2){
				puts("0");
				return 0;
			}
			if(l1<l2)
				Ans=2*Ans%Mod;
		}
	for(i=1;i<=N;i++)
		if(!Vis[i]){
			l=0;
			for(j=i;!Vis[j];j=A[j])
				Vis[j]=true,l++;
			Cnt[l]++;
		}
	for(i=1;i<=N;i++){
		l=((i&1)&&i>1)+1;
		F[0]=1,F[1]=l;
		for(j=2;j<=Cnt[i];j++)
			F[j]=(1ll*F[j-2]*(j-1)*i+F[j-1]*l)%Mod;
		Ans=1ll*Ans*F[Cnt[i]]%Mod;
	}
	printf("%d\n",Ans);
	return 0;
}

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

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
const ll infll = 1e18 + 7;

int n, m, k;
int x, y, z;
int ans, cnt, tmp, idx, val, sum, mx = -inf, mn = inf;
string s, t;
int a[N], b[N];
set <int> stt; map <int, int> mpp;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> x >> y;
    if (y >= x) cout << "un";
    cout << "safe";
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 3616
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    ll h,w;
    scanf("%lld%lld", &h, &w);

    ll min=LINF;
    {
        ll  h0=h/3;
        int i;
        for(i=h0-1; i<=h0+1; i++) {
            {
                ll s0=i*w;
                ll s1=(h-i)*(w/2);
                ll s2=h*w-s0-s1;
                ll tmp=MAX(MAX(s0,s1),s2)-MIN(MIN(s0,s1),s2);
                min=MIN(min,tmp);
            }

            {
                ll s0=i*w;
                ll s1=(h-i)/2*w;
                ll s2=h*w-s0-s1;
                ll tmp=MAX(MAX(s0,s1),s2)-MIN(MIN(s0,s1),s2);
                min=MIN(min,tmp);
            }
        }
    }
    swap(h,w);
    {
        int h0=h/3;
        int i;
        for(i=h0-1; i<=h0+1; i++) {
            {
                ll s0=i*w;
                ll s1=(h-i)*(w/2);
                ll s2=h*w-s0-s1;
                ll tmp=MAX(MAX(s0,s1),s2)-MIN(MIN(s0,s1),s2);
                min=MIN(min,tmp);
            }

            {
                ll s0=i*w;
                ll s1=(h-i)/2*w;
                ll s2=h*w-s0-s1;
                ll tmp=MAX(MAX(s0,s1),s2)-MIN(MIN(s0,s1),s2);
                min=MIN(min,tmp);
            }
        }
    }
    printf("%lld\n", min);

    return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static int N;
    static int[] X;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        X = sc.nextIntArray(N);

        PrintWriter pw = new PrintWriter(System.out);
        for (int i : solve()) {
            pw.println(i);
        }
        pw.flush();
    }

    static int[] solve() {
        int[] S = Arrays.copyOf(X, N);
        Arrays.sort(S);

        int a = S[N/2 - 1];
        int b = S[N/2];

        int[] ans = new int[N];

        for (int i = 0; i < N; i++) {
            if( X[i] <= a ) {
                ans[i] = b;
            } else {
                ans[i] = a;
            }
        }
        return ans;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 51628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        var A1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var A2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int top = A1[0];
        int bottom = A2.Sum();
        int max = top + bottom;
        for (int i = 1; i < N; i++)
        {
            top += A1[i];
            bottom -= A2[i - 1];
            max = Math.Max(max, top + bottom);
        }
        Console.WriteLine(max);
    }
}

Measured memory_bytes: 13396
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        string CODE = "CODEFESTIVAL2016";
        string S = cin.next();
        int ans = 0;
        for (int i = 0; i < 16; i++)
        {
            if (S[i] != CODE[i]) ans++;
        }
        Console.WriteLine(ans);
    }




}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11092
def main():
    n = int(stdinput())
    S = [*map(int, stdinput().split())]
    q = int(stdinput())
    T = [*map(int, stdinput().split())]

    S = sorted(S)
    T = sorted(T)

    i = j = c = 0

    while i < n and j < q:
        if S[i] == T[j]:
            c += 1
            i += 1
            j += 1
        elif S[i] > T[j]:
            j += 1
        else:
            i += 1
    
    print(c)

def stdinput():
    from sys import stdin
    return stdin.readline().strip()

if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()')


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

#define PB push_back
#define MP make_pair
#define SZ size()
#define Fr first
#define Sc second
#define si(a) scanf("%d", &a)
#define sl(a) scanf("%I64d", &a)
#define sd(a) scanf("%lf", &a)
#define ss(a) scanf("%s", a)
#define debug(x) cout << #x << ": " << x << endl
#define Fast_IO ios_base::sync_with_stdio(0);cin.tie(0)

typedef long long Long;
typedef pair <int, int> Pii;
///<-------------------------------------------------END OF TEMPLATE-------------------------------------------------->

#define MAX 100005
int N, A[MAX];

int main() {
   int mi = MAX, mx = -MAX;
   si(N);
   for(int i = 0; i < N; i++) {
      si(A[i]);
      mi = min(mi, A[i]);
      mx = max(mx, A[i]);
   }
   if(mx - mi > 1) {
      puts("No");
      return 0;
   }
   if(mx == mi) {
      if(2 * mx <= N || mx == N-1) puts("Yes");
      else puts("No");
      return 0;
   }

   int cntx = 0, cnti = 0;
   for(int i = 0; i < N; i++) {
      if(A[i] == mx) cntx++;
      else cnti++;
   }
   if(mx - cnti <= 0 || 2*(mx - cnti) > cntx) {
      puts("No");
   } else {
      puts("Yes");
   }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define INF 0x3f3f3f3f3f3f3f3f
#define PI acos(-1.0)
#define MOD 1000000007
//#define eps 1e-10
#define R freopen("555input.txt","r",stdin);
#define W freopen("medical.out","w",stdout);
//
#define N 105
#define M 1000000005
int n,i,j;
int main ()
{
    scanf("%d",&n);
    if(n/100==n%10)cout<<"Yes";
    else cout<<"No";




    return 0;

}


Measured memory_bytes: 256