akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main() {
	char a[11], b[11], c[11];
	int i,j;
	scanf("%s%s%s", &a, &b, &c);
	for (i = 0; a[i] != '\0'; i++);
	i--;
	for (j = 0; b[j] != '\0'; j++);
	j--;
	if (a[i] == b[0] && b[j] == c[0])
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}


Measured memory_bytes: 128
n = int(input())
h = [0]
h.extend(list(map(int, input().split())))
max = 0
flag = False

for i in range(n + 1):
    if h[i] > h[i - 1]:
        max = h[i]
    if max - h[i] >= 2:
        flag = True

if flag:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 14396
#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <cmath>
#include <cstring>

using namespace std;

const double EPS=(1e-10);
bool EQ(double a,double b){
    return abs(a-b)<EPS;
}

typedef complex<double> P;
typedef pair<double,double> pdd;

double calc(double a1,double b1,double a2,double b2,double x,double r){
    return (a2*a1*x*x*x)/3.0+(x*x*(a1*a2*r+b2*a1+a2*b1))/2.0+(a2*b1*r+b1*b2)*x;
}

int main(){
    int n;
    double r;
    while(cin>>n>>r&&!(n==0&&EQ(r,0))){
        vector<P> dots;
        vector<pdd> co;
        dots.push_back(P(-1000,0));
        for(int i=0;i<n;i++){
            double x,y;
            cin>>x>>y;
            dots.push_back(P(x,y));
        }
        dots.push_back(P(1000,0));
        double sum=0;
        for(int i=1;i<=n+1;i++){
            double a=(dots[i-1].imag()-dots[i].imag())/(dots[i-1].real()-dots[i].real());
            double b=dots[i-1].imag()-a*dots[i-1].real();
            co.push_back(pdd(a,b));
        }
        double ax=dots[1].real();
        double bx=ax+r;
        int nxtApos=n+2;
        int nxtBpos=n+2;
        // rツづ個値ツつェツづづ個凝ヲツ甘板づ可甘慊づ慊づェツづつ「ツづゥツつゥツづーツ探ツ催オ
        for(int i=0;i<=n+1;i++){
            if(dots[i].real()>bx&&!EQ(dots[i].real(),bx)){
                nxtBpos=i;
                break;
            }
        }
        for(int i=0;i<=n+1;i++){
            if(dots[i].real()>ax&&!EQ(dots[i].real(),ax)){
                nxtApos=i;
                break;
            }
        }
        // nxtBposツつェnツづ可づ按づゥツづ慊づ堕アツつッツづゥ
        while(nxtBpos!=n+2&&nxtApos!=n+2){
            // ツ篠淞づ個湘ェツ渉環づ鳴づ個仰猟猟」ツつェツ渉ャツつウツつ「ツづ個づ債づつソツづァツつゥ
            double adis=dots[nxtApos].real()-ax;
            double bdis=dots[nxtBpos].real()-bx;
            double dis=min(adis,bdis);
            double t=ax+dis;
            double s=ax;
            sum+=calc(co[nxtApos-1].first,co[nxtApos-1].second,co[nxtBpos-1].first,co[nxtBpos-1].second,t,r);
            sum-=calc(co[nxtApos-1].first,co[nxtApos-1].second,co[nxtBpos-1].first,co[nxtBpos-1].second,s,r);
            ax+=dis;bx+=dis;
            if(EQ(adis,bdis)){
                nxtApos++;
                nxtBpos++;
            }
            else if(adis<bdis)nxtApos++;
            else nxtBpos++;
        }
        printf("%.10f\n",sum);
    }
    return 0;
}

Measured memory_bytes: 988
package main


import (
	"fmt"
	"sort"
)

func main() {
	var a int
	var c float64
	var b []float64
	fmt.Scan(&a)
	for i := 0; i < a ; i++ {
		fmt.Scan(&c)
		b = append(b, c)
	}

	sort.Float64s(b)
	var d = b[0]
	for i := 1; i < a; i++ {
		d = (d + b[i]) / 2
	}
	fmt.Println(d)
}

Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    char t[4];
    scanf("%s",&t);

    if(t[0]==t[1]|| t[1]==t[2]||t[2]==t[3]){
        printf("Bad\n");
    }
    else{
        printf("Good\n");
    }
    return 0;


}


Measured memory_bytes: 128
/*
    author:  Maksim1744
    created: 20.06.2020 15:00:52
*/

#include <bits/stdc++.h>

using namespace std;

#define ll   long long
#define ld   long double

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             vector<T>& operator--            (vector<T>& v){for (auto& i : v) --i;            return  v;}
template<typename T>             vector<T>& operator++            (vector<T>& v){for (auto& i : v) ++i;            return  v;}
template<typename T>             istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}
template<typename T, typename U> pair<T,U> operator-(pair<T,U> a, pair<T,U> b){return mp(a.first-b.first, a.second-b.second);}
template<typename T, typename U> pair<T,U> operator+(pair<T,U> a, pair<T,U> b){return mp(a.first+b.first, a.second+b.second);}
template<typename T, typename U> void umin(T& a, U b){if (a > b) a = b;}
template<typename T, typename U> void umax(T& a, U b){if (a < b) a = b;}

#ifdef HOME
#define TAG_LENGTH       25
#define LR_LEFT          left
#define LR_RIGHT         right
#define LR_VALUE         value
#define LR_SECOND_VALUE  mn
#include "C:/C++ libs/print.cpp"
#else
#define showl            42;
#define shows            42;
#define show(...)        42;
#define showm(...)       42;
#define showt(...)       42;
#define printTree(...)   42;
#define printGraph(...)  42;
#define printLRTree(...) 42;
#define printMatrix(...) 42;
#define printWGraph(...) 42;
#define debug     if (false)
#endif

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

    int x;
    cin >> x;
    int ans = 1;
    int s = x;
    while (s % 360 != 0) {
        s += x;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3608
/**
*
* Author: MARS
* Lang: GNU C++14
*
**/

#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >

typedef unsigned long long ull;
typedef long double ldbl;
typedef long long ll;
typedef double dbl;

const ldbl E = 2.71828182845904523536;
const ldbl pi = acos(-1);
const dbl eps = 1e-9;
const ll mod = 1e9+7;
const ll inf = 1LL<<30;

/** /////////// ** Code ** /////////// **/

const int N=200200;
int a[N] , p[N];

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0 ; i<n ; i++)
        scanf("%d",&a[i]);

    int mx=0;
    for(int i=0 ; i<n ; i++){
        int x=a[i];
        p[x] = max(p[x] , 1+p[x-1]);
        mx=max(mx,p[x]);
    }


    printf("%d",n-mx);

    return 0;
}


Measured memory_bytes: 1792
import java.util.*;
import java.lang.*;

/**
 * DrawingLots
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];

        for (int i = 0; i < n; i++) {
            String str = sc.next();
            String list[] = str.split(",");
            a[i] = Integer.valueOf(list[0]);
            b[i] = Integer.valueOf(list[1]);
        }

        for (int i = 1; i <= w; i++) {
            int num = i;
            for (int j = n - 1; j >= 0; j--) {
                if (a[j] == num) {
                    num = b[j];
                } else if (b[j] == num) {
                    num = a[j];
                }
            }
            System.out.println(num);
        }
    }
}


Measured memory_bytes: 25888
#include <iostream>

int main(void){
    using namespace std;
    static int s[2001][1001];
    char c;
    int n, k, x, y;
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> k;
    for(int i=0; i<n; i++){
        cin >> x >> y >> c;
        y %= 2*k;
        if(c=='W'){
            x += k;
        }
        if(y>=k){
            y-=k;
            x+=k;
        }
        x %= 2*k;
        s[x+1][y+1]++;
    }
    for(int x=0; x<2*k; x++){
        for(int y=0; y<k; y++){
            s[x+1][y+1] += s[x][y+1] + s[x+1][y] - s[x][y];
        }
    }
    int max = 0;
    int v = s[0][0] - s[2*k][0];
    for(int x=0; x<k; x++){
        int u = v - s[x][0] - s[x][k] + s[x+k][0] + s[x+k][k];
        for(int y=0; y<k; y++){
            int t = u - s[0][y] + 2*s[x][y] - 2*s[x+k][y] + s[2*k][y];
            t = t<n/2 ? n-t : t;
            max = t>max ? t : max;
        }
    }
    cout << max;
    return 0;
}


Measured memory_bytes: 8064
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        Dim K As Integer = NextInt()

        Dim l As Integer() = New Integer(N - 1) {}
        For i As Integer = 0 To N - 1
            l(i) = NextInt()
        Next
        Array.Sort(l)
        Array.Reverse(l)

        Dim ans As Integer
        For i As Integer = 0 To K - 1
            ans += l(i)
        Next

        WriteLine(ans)
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


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

int main() {
  int N; cin >> N;
  vector<pair<long long, long long>> ba(N+1);
  ba.at(0) = make_pair(0, 0);
  for (int i = 1; i <= N; i++) {
    long long a, b; cin >> a >> b;
    ba.at(i) = make_pair(b, a);
  }
  long long time = 0;
  sort(ba.begin(), ba.end());
  bool flag = true;
  for (int i = 1; i <= N; i++) {
    time += ba.at(i).first - ba.at(i-1).first - ba.at(i).second;
    if (time < 0) flag = false;
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3328
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      String s = next();
      ArrayList<String> output = myconv("abcdefghijklmnopqrstuvwxyz", 0);
      myout(output.get(output.indexOf(s) + 1));
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 33168
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  int a, b;
  cin >> a >> b;
  int ans = max(a + b, max(a - b, a * b));
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
int main() 
{
    cin>>a>>b>>c;
    if(a%2==0 || b%2==0 || c%2==0)
        cout<<0<<endl;
    else
        cout<<min(min(a*b,a*c),b*c)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int k = scan.nextInt();
    int n = scan.nextInt();
    int g = 0;
    ArrayList<Integer> c = new ArrayList<Integer>();
    for (int i=0;i<n;i++){
      g = scan.nextInt();
      c.add(g);
    }

    ArrayList<Integer> a = new ArrayList<Integer>();
    ArrayList<Integer> b = new ArrayList<Integer>();

    for (int j=0;j<n;j++){
      if (j == 0){
        a.add(c.get(n-1) - c.get(0));
        b.add(k - c.get(1) + c.get(0));
        continue;
      }
      if (j == n-1){
        a.add(k-c.get(n-1)+c.get(n-2));
        b.add(c.get(n-1) - c.get(0));
        continue;
      }
      a.add(k-c.get(j)+c.get(j-1));
      b.add(k-c.get(j+1)+c.get(j));
    }

    int min = k;
    for (int t = 0;t<n;t++){
      if (a.get(t) < min){
        min = a.get(t);
      }
      if (b.get(t) < min){
        min = b.get(t);
      }
    }
    System.out.println(min);
  }
}


Measured memory_bytes: 75208
#include <bits/stdc++.h>
#define ll long long int
#define Max 100007

using namespace std;

ll n;
string str[3];
ll ans = 0;

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    string t;
    for(ll i = 0 ; i < 3 ; i++) {
        cin >> str[i];
    }
    for(ll i = 0 ; i < n ;i++){
        set<char>s;
        s.insert(str[0][i]);
        s.insert(str[1][i]);
        s.insert(str[2][i]);

        ans += s.size() - 1;
    }
    cout << ans;

    return 0;
}


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

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i,N) cin >> H.at(i);
    ll ans = 0;
    sort(H.begin(), H.end(), greater<ll>());
    if (N > K) {
        for (int i = K; i < N; ++i) {
            ans += H.at(i);
        } 
    }
    cout << ans << endl;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

bool checked[100010];
int ans[100010];
vector<pair<int, int>> G[100010];

void dfs(int v, int c)
{
	if (checked[v])return;
	checked[v] = true;
	ans[v] = c;
	for (auto& e : G[v])
	{
		if (!checked[e.first])
		{
			dfs(e.first, e.second % 2 == 0 ? c : c ^ 1);
		}
	}
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	int u, v, w;
	rep(i, 0, N - 1)
	{
		cin >> u >> v >> w;
		u--;
		v--;
		G[u].push_back(mp(v, w));
		G[v].push_back(mp(u, w));
	}

	dfs(0, 0);

	rep(i, 0, N)
	{
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 10240
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
 int n,ti,id,tp,sc,bb,ed,tpn=-1,scn,bbn=-1,edn=-1,m1,m2,m3,m4,s1,s2,s3,s4;
 while(cin >> n) {
	 if (n==0) break;
	 tp=sc=99999; bb=ed=0;
	 for (;n>0;n--) {
		 cin >> id >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4;
		 ti=(m1+m2+m3+m4)*60+s1+s2+s3+s4;
		 if (tp>ti) { sc=tp; scn=tpn; tp=ti; tpn=id; }
		 if (tp<ti && sc>ti) { sc=ti; scn=id;}
		 if (ed<ti) { bb=ed; bbn=edn; ed=ti; edn=id;}
		 if (ed>ti && bb<ti) { bb=ti; bbn=id;}
	 }
	 cout << tpn << endl;
	 cout << scn << endl;
	 cout << bbn << endl;
 }
 return 0;
 }

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
const long long inf=1000000000000000000;
int main(){
    #define int long long
    int n,K;
    cin>>n>>K;
    int p[n],c[n];
    for(int i=0;i<n;i++){
        cin>>p[i];
        p[i]--;
    }
    for(int i=0;i<n;i++)cin>>c[i];
    int ans=-inf;
    for(int i=0;i<n;i++){
        int v=i,k=K,score=0,maxscore=-inf,syuki=1,syuki_score,start,cont=0;
        int visit[n]={};
        while(visit[v]==0 && k>0){
            visit[v]=1;
            v=p[v];
            score+=c[v];
            maxscore=max(maxscore,score);
            k--;
        }
        ans=max(ans,maxscore);
        if(k==0)continue;
        start=v;
        syuki_score=c[v];
        while(p[v]!=start){
            v=p[v];
            syuki_score+=c[v];
            syuki++;
        }
        if(syuki_score>0)score+=syuki_score*(k/syuki-1);
        k=k%syuki+syuki;
        maxscore=score;
        for(int j=0;j<k;j++){
            v=p[v];
            score+=c[v];
            maxscore=max(maxscore,score);
        }
        ans=max(ans,maxscore);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3696
import java.util.*;
public class Main{
	public static void main(String[] args){
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int max = 0;
		if(a+b >= a-b){
			max = a+b;
		}else{
			max = a-b;
		}
		
		if(max < a*b){
			max = a*b;
		}
		
		System.out.println(max);
	}
}

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

int main(){
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;
  for(int i=1;i<=a+b+1;i++){
    //cout << "i:" << i << "s[i]:" << s[i] << endl;
    if (i == a+1){
      if (s[i-1] == '-'){
        continue;
      }else{
        //cout << "case1" << endl;
        cout << "No" << endl;
        return 0;
      }
    }else{
      if (isdigit(s[i-1])){
        continue;
      }else{
        //cout << "case2" << endl;
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int, int> pii;

template <typename A, typename B>
string to_string(pair<A, B> p){
    return "(" + to_string(p.fi) + ", " + to_string(p.se) + ")";
}

template <typename T>
string to_string(T v){
    string s = "{";
    bool first = true;
    for(const auto & x : v){
        if(!first) s += ", ";
        first = false;
        s += to_string(x);
    }
    return s + "}";
}

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int main(){
    fcin;
    int n;  cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < n; i++){
        set<char> st, st2;
        for(int j = i - 1; j >= 0; j--) st.insert(s[j]);
        for(int j = i; j < n; j++) st2.insert(s[j]);
        
        int cnt = 0;
        for(auto i : st) if(st2.count(i)) cnt++;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define INF 1e9
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll x,ll y){ll res=1;while(y>0){if(y&1)res=res*x;y=y>>1;x=x*x;}return res;}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]>x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
int main()
{
	fastio();
	ll N;
	cin>>N;
	N=powe(2,logtwo(N)+1);
	//cout<<N<<endl;
	cout<<N-1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn =1e5 + 28;
vector <pair<int, int>> v;
bool mark[maxn];
long long ans, sum;
stack <int> v2;
int type;
int main(){
	int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		int x, y;
		cin >> x >> y;
		v.push_back({y, x});
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	for(int i = 0; i < k; i++){
		sum += v[i].first;
 		if(!mark[v[i].second]){
			type ++;
			mark[v[i].second] = 1;
		}
		else
			v2.emplace(v[i].first);
	}
	ans = sum + ((long long)type * type);
	for(int i = k; i < n; i++){
		bool flag = 0;
	//	sum += v[i].first;
		if(!mark[v[i].second]){
			type ++;
			mark[v[i].second] = 1;
			flag = 1;
		}
		//else
			//v2.emplace(v[i].first);
		if(v2.empty())
			break;
		if(flag){
			sum += v[i].first;
			sum -= v2.top();
			v2.pop();
			ans = max(ans, (sum + ((long long)type * type)));
		}
	}
	cout << ans;
	
}

Measured memory_bytes: 1400
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

// 素因数分解 O(√n)以下
// (素因数,個数)
template<typename T>
vector<pair<T, T> > prime_factorization(T n) {
    vector<pair<ll, ll> > res;
    for (ll i = 2; i*i <= n; i++) {
        int cnt = 0;
        while (n % i == 0) {
            n /= i;
            cnt++;
        }
        if (cnt > 0) res.push_back(make_pair(i,cnt));
    }
    if (n > 1) res.push_back(make_pair(n,1));
    return res;
}

// g++ -std=c++11 prac.cpp 
int main(){
    ll x,y,z,n,p,m=0,k,h,w,sum=0,ans=1,Max=-1e9,count=0,Min=1e9+1;
    string s,t,u,v;
    bool ok=false;
    cin >> n >> m >> k;
    if( k%n==0 || k%m==0 ){ cout << "Yes" << endl; return 0;}
    for(int i=1;i<=m; i++){
        for(int j=1; j<=n; j++){
            sum = (n * i)  + (m * j) - ((i*j)*2);
            if(sum == k){
                cout << "Yes" << endl; 
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,m;
    cin >> n >> m;
    vector<vector<int32>> adj(3 * n);
    REP(i,m){
        int32 u,v;
        cin >> u >> v;
        u--;v--;
        adj[u].pb(v + n);
        adj[u + n].pb(v + 2 * n);
        adj[u + 2 * n].pb(v);
    }
    int32 s,t;
    cin >> s >> t;
    s--;t--;
    vector<int32> dist(3 * n, INF);
    dist[s] = 0;
    queue<int32> que;
    que.push(s);
    while(!que.empty()){
        int32 u = que.front();
        que.pop();
        for(int32 v : adj[u]){
            if(dist[v] > dist[u] + 1){
                dist[v] = dist[u] + 1;
                que.push(v);
            }
        }
    }
    if(dist[t] == INF)dist[t] = -3;
    cout << dist[t] / 3 << endl;
    return 0;
}

Measured memory_bytes: 19072
#include <iostream>
using namespace std;
typedef long long ll;

const ll MOD = 998244353;

ll dp[3002][3002];

int main()
{
    int n, s;
    cin >> n >> s;
    int a[3002];
    for(int i = 0; i < n; i++) cin >> a[i];
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = a[i - 1]; j <= s; j++){
            dp[i][j] = dp[i - 1][j - a[i - 1]];
        }
        for(int j = 0; j <= s; j++){
            dp[i][j] = (dp[i][j] + dp[i - 1][j] * 2) % MOD;
        }
    }
    cout << dp[n][s] << endl;
}


Measured memory_bytes: 73964
a, b, c = map(int, input().split())
k = int(input())
if a >= b and a >= c:
    d = a
    e = b
    f = c
if b >= a and b >= c:
    d = b
    e = a
    f = c
else:
    d = c
    e = a
    f = b
# 出力
print (e + f + d * 2 ** k)

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

int main(){
	int k, s;
	cin >> k >> s;
	int sum = 0;
	for (int x = 0; x <= k; ++x) {
		int ymin = max(0, s - x - k);
		int ymax = min(k, s - x);
		sum += max(0,ymax-ymin+1);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    
    if(w >= x+r && h >= y+r && x-r >= 0 && y-r >= 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int n;
int dis[310][310];
bool fail;
bool vip[310][310];
inline int read()
{
    int x=0;
    char ch=getchar();
    while(ch<'0'||ch>'9')
        ch=getchar();
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x;
}
int main()
{
    n=read();
    for(int i=1; i<=n; i++)
        for(int j=1; j<=n; j++)
            dis[i][j]=read();
    for(int i=1; i<=n; i++)
        for(int j=1; j<=n; j++)
            for(int k=1; k<=n; k++)
                if(i!=j&&j!=k&&k!=i)
                {
                    if(dis[i][j]+dis[j][k]<dis[i][k])
                        fail=true;
                    else if(dis[i][j]+dis[j][k]==dis[i][k])
                        vip[i][k]=true;
                }
    if(fail)
        puts("-1");
    else
    {
        long long ans=0;
        for(int i=1; i<=n; i++)
            for(int j=i+1; j<=n; j++)
                if(!vip[i][j])
                    ans+=dis[i][j];
        printf("%lld",ans);
    }
    return 0;
}


Measured memory_bytes: 768
nyan :: Int -> [Int]
nyan 0 = []
nyan x
    | even x = nextNyan
    | odd  x = 1 : nextNyan
        where nextNyan = map (* 2) $ nyan $ div x 2

solve :: Int -> IO ()
solve = putStrLn . unwords . map show . nyan

main :: IO ()
main = getContents
    >>= mapM_ solve . map read . lines

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

int main(){
  int w, a, b;
  cin >> w >> a >> b;
  int min = a;
  int max = b;
  if(b<a){
    min=b;
    max=a;
  }
  int diff=0;
  if(max > min+w){
  	diff=max-(min+w);
  }
  cout << diff << endl;
return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define f first
#define s second

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

const ll INF= ll (1e18);
const int MOD= 1e9+7;
const int N=200000+10;

int dig(ll n)
{
    int cnt=0;

    while(n)
    {
        n/=10;
        cnt++;
    }
    return cnt;
}
int main()
{
    std::ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n;
    cin>>n;

    ll n1=floor(sqrt(n));

    ll ans;
    while(n1>0)
    {
        if(n%n1==0)
        {
            ans=n/n1;
            cout<<dig(ans);
            return 0;
        }
        n1--;
    }

    return 0;
}


Measured memory_bytes: 256
$N=int(<STDIN>);
push @T,0;push @X,0;push @Y,0;
for($i=0;$i<$N;$i++){
	($t,$x,$y)=split " ",<STDIN>;
	push @T,$t;push @X,$x;push @Y,$y;
}
for($i=1;$i<=$#T;$i++) {
	$dt=$T[$i]-$T[$i-1];
	$dx=$X[$i]-$X[$i-1];
	$dy=$Y[$i]-$Y[$i-1];
	$d=$dt-$dx-$dy;
	if($d<0 || $d%2>0) { $f=1; break;  }
}

print ($f?"No":"Yes");


Measured memory_bytes: 31232
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for(int i=1;i<=n-1;i++){ //何文字目で切るか
    int tmp = 0; //iごとにOKな文字種はいくつあるか
    for(char c='a';c<='z';c++){
      bool check1 = 0; //左に含まれる
      bool check2 = 0; //右に含まれる
      for(int j=0;j<i;j++){
        if(s[j] == c) check1 = 1;
      }
      for(int j=i;j<n;j++){
        if(s[j] == c) check2 = 1;
      }
      if(check1 && check2) tmp ++;
    }
    ans = max(tmp,ans);
  }
  cout << ans << endl;
}

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

const int MOD = 998244353;
const int maxn = 2e5 + 5;
int Bit[maxn], A[maxn], n;
pair<int, int> P[maxn];

void Update(int i) {

    while(i <= n) {
        Bit[i]++;
        i += i&(-i);
    }
}
int Getsum(int i) {

    int res = 0;
    while(i) {
        res += Bit[i];
        i -= i&(-i);
    }
    return res;
}

int main() {

    scanf("%d", &n);
    for(int i = 0; i < n; i++)
        scanf("%d%d", &P[i].first, &P[i].second);

    sort(P, P+n);
	for(int i = 0; i < n; i++) {
        P[i].first = P[i].second;
        P[i].second = i;
	}
	sort(P, P+n);
    A[0] = 1;
	for(int i = 1; i <= n; i++) {
        A[i] = A[i-1]<<1;
        if(A[i] >= MOD) A[i] -= MOD;
	}

	int ans = (long long)n*A[n]%MOD;
	for(int i = 0; i < n; i++) {

        int j = P[i].second, k = Getsum(j);
        int a = A[k], b = A[i-k], c = A[j-k], d = A[n-1-(i+j-k)];
        ans = (ans-(long long)(a+d-1)*(b+c-1)%MOD) % MOD;
        Update(j+1);
	}
	if(ans < 0) ans += MOD;
	printf("%d", ans);
	return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);

//int dxy[5] = {0, 1, 0, -1, 0};
// assign

signed main()
{
    int n, t, l, b;
    cin >> n >> t >> l >> b;
    while (n) {
        vb lose(n+1, false), back(n+1, false);
        rep(i, l) {
            int tmp;
            cin >> tmp;
            lose[tmp] = true;
        }
        rep(i, b) {
            int tmp;
            cin >> tmp;
            back[tmp] = true;
        }
        double dp[111][111];
        memset(dp, 0, sizeof(dp));
        dp[0][0] = 1.0;
        rep(i, t) {
            rep(j, n) {
                Rep(k, 7) {
                    int ni = i+1, nj = (j+k <= n) ? j+k : n+n-j-k;
                    if (lose[nj]) { ni++; }
                    if (back[nj]) { nj = 0; }
                    dp[ni][nj] += dp[i][j] / 6.0;
                }
            }
            dp[i+1][n] += dp[i][n];
        }
        printf("%.10lf\n", dp[t][n]);
        cin >> n >> t >> l >> b;
    }

    return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	ll a,b;
	cin >> a >> b;
	cout << lcm(a,b) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include<cmath>
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// --------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  ll sum = 1;
  for(int i=0; i<N; i++){
    sum *= 10;
    sum %= mod;
  }
  ll sub = 1;
  for(int i=0; i<N; i++){
    sub *= 8;
    sub %= mod;
  }
  ll nine = 1;
  for(int i=0; i<N; i++){
    nine *= 9;
    nine %= mod;
  }
  nine = (sum - nine+mod)%mod;
  ll ans = (sub+nine+nine-sum+mod)%mod;
  cout << ans << "\n";
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n;cin>>n;
	vl a(n);
	rep(i,n)cin>>a[i];
	ll sum1[n+1],sum2[n+1];
    mem(sum1,0);
    mem(sum2,0);
	sum1[0]=a[0];sum2[0]=0;
	for(int i=1;i<n;++i){
		if(i%2==0){
			sum1[i]=sum1[i-1]+a[i];
			sum2[i]=sum2[i-1];
		}
		else{
			sum1[i]=sum1[i-1];
			sum2[i]=sum2[i-1]+a[i];
		}
	}
	ll dp[n][2];
	mem(dp,0);
	dp[0][0]=0;
	dp[0][1]=a[0];
	dp[1][0]=dp[0][1];
    dp[1][1]=dp[0][0]+a[1];
	if(n>=3){
	dp[2][0]=max(dp[1][0],dp[1][1]);
	dp[2][1]=dp[0][0]+a[2];
	for(int i=3;i<n;++i){
		if(i%2==0){
			dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
			dp[i][1]=max(dp[i-2][0],dp[i-2][1])+a[i];
		}
		if(i%2==1){
			dp[i][0]=dp[i-2][0]+a[i-1];
			dp[i][1]=dp[i-1][0]+a[i];
		}
	}
	}
	cout<<max(dp[n-1][0],dp[n-1][1])<<endl;
}


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

struct Dice{
  int dice[6];
  void roll(char c){
    int b;
    if(c == 'E'){
      b = dice[0];
      dice[0] = dice[3];
      dice[3] = dice[5];
      dice[5] = dice[2];
      dice[2] = b;
    }
    if(c == 'W'){
      b = dice[0];
      dice[0] = dice[2];
      dice[2] = dice[5];
      dice[5] = dice[3];
      dice[3] = b;
    }
    if(c == 'N'){
      b = dice[0];
      dice[0] = dice[1];
      dice[1] = dice[5];
      dice[5] = dice[4];
      dice[4] = b;
    }
    if(c == 'S'){
      b = dice[0];
      dice[0] = dice[4];
      dice[4] = dice[5];
      dice[5] = dice[1];
      dice[1] = b;
    }
    if(c == 'R'){
      b = dice[1];
      dice[1] = dice[2];
      dice[2] = dice[4];
      dice[4] = dice[3];
      dice[3] = b;
    }
  }
  int top() {
    return dice[0];
  }
  int right(){
    return dice[2];
  }
  int left(){
    return dice[3];
  }
  int front(){
    return dice[1];
  }
};
bool same(Dice a,Dice b){
  for(int i = 0; i < 6; i++){
    if(a.dice[i]!=b.dice[i]){
        return false;
    }
  }
  return true;
}

int main(){
  Dice d[100];
  int n;
  cin >> n;
  for(int j = 0; j < n; j++){
    for(int i = 0;i < 6;i++){
      cin >> d[j].dice[i];
    }
  }
  bool ff = true;
  for(int k = 0; k < n - 1; k++){
    for(int l = k + 1;l < n;l++){
      bool f=false;
      for(int i = 0;i < 4;i++){
	    d[l].roll('R');
	    for(int j = 0;j < 4;j++){
	      d[l].roll('N');
	      if(same(d[k],d[l])){
	         f = true;
	      } 
	    }
      }
      d[l].roll('E');
      for(int j = 0; j < 4;j++){
	    d[l].roll('N');
	    if(same(d[k],d[l])){
	       f = true;
	    } 
      }
      d[l].roll('W');
      d[l].roll('W');
      for(int j = 0; j < 4; j++){
	    d[l].roll('N');
	    if(same(d[k],d[l])){
	      f = true;
	    }
      }
      if(f){
          ff = false;
      }
    }
  }
  cout << (ff?"Yes":"No") << endl;
  return 0;
}



Measured memory_bytes: 3104
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v){
    if(v.empty()){
        os<<"{ }";
        return os;
    }
    os<<"{"<<v.front();
    for(auto itr=++v.begin();itr!=v.end();itr++){
        os<<", "<<*itr;
    }
    os<<"}";
    return os;
}

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,ans=0; cin>>n;
    for(ll i=1;i<n;i++){
        ans+=(n-1)/i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
A, B = map(int, input().split())

num_list = [A, B]
first_num = max(num_list)
first_choice_index = num_list.index(first_num)
num_list[first_choice_index] = num_list[first_choice_index] - 1
second_num = max(num_list)

print(first_num + second_num)


Measured memory_bytes: 2940
package main
import "fmt"

func main(){
	var a,b int
	fmt.Scan(&a,&b)
	if a>b {
		fmt.Print("a > b\n")
	} else if a<b {
		fmt.Print("a < b\n")
	} else {
		fmt.Print("a == b\n")
	}
	
}



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

long long n,m,a,b,l[200005];
string s;
int main(){
    cin>>n;
    for (int i=0; i<n; i++){
        cin>>l[i];
        if (a==0){
            a=l[i];
            b++;
        }
        else if (a>=l[i]){
            b++;
        }
        a=min(a,l[i]);
    }
    cout<<b<<endl;
}


Measured memory_bytes: 1792
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def local_input():# {{{
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)
# }}}

def solve():
    n = int(input())
    mt = list(map(int,input().split()))
    sm = sum(mt) // 2
    ans = [0]*n
    mt1 = [0] + mt

    ans[0] = 2*(sm - sum(mt1[::2]))

    for i in range(1,n):
        ans[i] = 2*(mt[i-1] - (ans[i-1] //2))
    
    print(' '.join(map(str,ans)))
    return 0

if __name__ == "__main__":# {{{
    try:
        local_input()
        def dump(*args):
            names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
            print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)
    except:
        def dump(*args):
            pass

    solve()

# vim: set foldmethod=marker:}}}


Measured memory_bytes: 126288
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

int main(){
    
    long a, b, n, ans;
    cin >> a >> b >> n;
    
    if(n < b){
        ans = (long) a * n / b;
    } else {
        ans = (long) a * (b - 1) / b;
    }
    
    cout << ans << "\n";
    
    return 0;
}



Measured memory_bytes: 3148
#include <iostream>
#include <cmath>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

int N, M;

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

  if(abs(N - M) > 1) cout << 0 << endl;
  else {
    ll ans = N == M ? 2 : 1;
    REP(i, 1, N + 1) {
      ans *= i;
      ans %= MOD;
    }
    REP(i, 1, M + 1) {
      ans *= i;
      ans %= MOD;
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for (int i=(n)-1;i>=0;i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define REPS(i,f,n) for (int i=(f)-1;i>=(n);i--)
int dx[4] = {1, 0, 0, -1};
int dy[4] = {0, 1, -1, 0};

void slove(int n, int m){
	vint vtaro(n);
	vint vhana(m);
	int sumtaro = 0, sumhana = 0;
	rep(i, n){
		int tmp;
		scanf("%d", &tmp);
		sumtaro += tmp;
		vtaro[i] = tmp;
	}
	sort(all(vtaro));

	rep(i, m){
		int tmp;
		scanf("%d", &tmp);
		sumhana += tmp;
		vhana[i] = tmp;
	}
	sort(all(vhana));

	double sa = sumtaro - sumhana; //????¨??????????
	rep(i, n){
		rep(j, m){
			if (vtaro[i] - vhana[j] == (sa / 2)){
				printf("%d %d\n", vtaro[i], vhana[j]);
				return;
			}
		}
	}
	printf("-1\n");
	return;
}

int main(void){
	int n, m;
	rep(i, 1000){
		cin >> n >> m;

		if (n == 0) break;
		slove(n, m);
	}
	return 0;
}

Measured memory_bytes: 3144