akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	ll n, a, b; cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0ll, (a + b) - n) << endl;
}


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

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  string s; cin >> s;
  int n = s[s.size()-1] - '0';
  if(n == 3) {
    cout << "bon";
  } else if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
    cout << "hon";
  } else {
    cout << "pon";
  }
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3628
#include <iostream>
#include <string>
using namespace std;
 
int main() {
	  int n;
  	cin >> n;
  	
  	string s = "";

  	for (int i = 0; i < n; i++) {
     	s += "ACL";
    }
  
  	cout << s << endl;
  
  	return 0;
}

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

int main() {
	int n, l[210], ans = 0, min1 = 200, min2 = 200, min1num, min2num;
	cin >> n;
	for (int i = 1; i <= 2 * n; i++) cin >> l[i];
	for (int i = 1; i <= n; i++) {
	    for (int j = 1; j <= 2 * n; j++) {
	        if (min1 > l[j]) {
	            min1 = l[j];
	            min1num = j;
	        }
	    }
      	ans += min1;
      	l[min1num] = 200;
      	for (int j = 1; j <= 2 * n; j++) {
	        if (min2 > l[j]) {
	            min2 = l[j];
	            min2num = j;
	        }
	    }
	    min1 = 200; min2 = 200;
      	l[min2num] = 200;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<set>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	int c[3][3]={};
	rep(i,3){
		rep(j,3){
			cin >>c[i][j];
			}
	}
	bool flag = 1;

	rep(i,2){
		if (c[i][0]-c[i+1][0]!=c[i][1]-c[i+1][1] || c[i][1]-c[i+1][1]!=c[i][2]-c[i+1][2]){
			flag = 0;
		}
	}

	rep(i,2){
		if (c[0][i]-c[0][i+1]!=c[1][i]-c[1][i+1] || c[1][i]-c[1][i+1]!=c[2][i]-c[2][i+1]){
			flag = 0;
		}
	}

	if(flag) cout << "Yes"<<endl;
	else cout << "No"<<endl;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("O3")
#define lll __int128_t
#define ll long long int
#define FOR(i,a,b) for(ll (i)=(a);i<(ll)(b);i++)
#define FORr(i,a,b) for(ll(i)=(a);i>(ll)(b);i--)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,n)
#define outi(a) printf("%lld\n",(a))
#define case(i) cout << "Case " << i << ": ";
#define pb push_back
#define in(n) ll n = read();
#define show(arr) for(auto a : arr) cout << a << " "; cout << endl;
#define inp(arr, n) ll arr[n] ; rep(i,n) arr[i] = read();
#define mp make_pair
#define f first 
#define s second 
#define mod 1000000007
#define modu(a) if(a>=mod) a-=mod;
#define test int tt = read(); rep(i,tt) solve(i+1);
using namespace std;
inline ll read()
{
    ll x=0; static ll p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
    return x;
}
int solve(int tt);
int main()
{
   // system("clear");
    //freopen("input.txt", "r", stdin);
    in(a) in(b)
    if((a-b)%2 == 0)
    {
        ll pos1 = (a+b)/2;
        ll pos2 = (a-b)/2;
        if(abs(a-pos1) == abs(b-pos1))
        {
            cout << pos1 << endl;
            return 0;
        }
        else if(abs(a-pos2) == abs(b-pos2))
        {
            cout << pos2 << endl;
            return 0;
        }
        else cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    else
    {
        ll pos1 = (a+b)/2;
        if(abs(a-pos1) == abs(b-pos1))
        {
            cout << pos1 << endl;
            return 0;
        }
        else cout << "IMPOSSIBLE" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
/** Problem0134 : Exit Survey **/
int main()
{
	long tot=0;
	int n;
	cin >> n;
	for (int i=0; i<n; i++) {
		int a;
		cin >> a;
		tot+=a;
	}
	cout << tot/n << endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void){

	int n,i,a,b;
	int toa,tob;

	while(1){
		scanf("%d",&n);
		if(n==0) break;
		toa=0; tob=0;
		for(i=0;i<n;i++){
			scanf("%d %d",&a,&b);
			if(a>b) toa+=a+b;
			else if(a<b) tob+=a+b;
			else{toa+=a; tob+=b;}
		}
		printf("%d %d\n",toa,tob);
	}
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(W >= x+r && H >= y+r && r <= x && r <= y){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}



Measured memory_bytes: 2104
using System.Text;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var a = new int[m];
        var b = new int[m];
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            a[i] = int.Parse(line[0]);
            b[i] = int.Parse(line[1]);
        }
        var c = getAns(a, b, n, m);
        var p1 = 0L;
        for (int i = 0; i < m; i++) p1 += (a[i] + 1) % b[i];
        print(c, p1, n, m);

    }
    static void print(long[] c, long p1, int n, int m)
    {
        var sb = new StringBuilder();
        for (int i = 1; i <= n; i++)
        {
            var w = p1 + c[i] + m * (long)(i - 1);
            sb.Append(string.Format("{0}\n", w));
        }
        Console.Write(sb);
    }
    static long[] getAns(int[] a, int[] b, int n, int m)
    {
        var c = new long[n + 1];
        for (int i = 0; i < m; i++)
        {
            var bi = b[i];
            var p = bi - a[i];
            while (p <= n)
            {
                if (p != 1) c[p] -= bi;
                p += bi;
            }
        }
        for (int i = 2; i <= n; i++)
            c[i] = c[i - 1] + c[i];
        return c;
    }
}



Measured memory_bytes: 27676
#include<stdio.h>
#define max 101
int h,w;
char map[max+1][max+1];


void search(int _h, int _w){
	if(map[_h][_w]=='>'){map[_h][_w]='#';search(_h,_w+1);}
	else if(map[_h][_w]=='v'){map[_h][_w]='#';search(_h+1,_w);}
	else if(map[_h][_w]=='^'){map[_h][_w]='#';search(_h-1,_w);}
	else if(map[_h][_w]=='<'){map[_h][_w]='#';search(_h,_w-1);}
	else if(map[_h][_w]=='.'){printf("%d %d\n",_w,_h);return ;}
	else if(map[_h][_w]=='#'){printf("LOOP\n");return;}
	
}
int main(){
	int i;
	
	for(;scanf("%d %d\n",&h,&w)&&(w||h);){
		for(i=0;i<h;i++){
			fgets(map[i], w+1 ,stdin);
			scanf("\n");
		}
		search(0,0);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
/*int p = 998244353;*/
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
#define itn int
int RE() {
	vel v(3, 2);
	return v.at(4);
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a,p - 2);
}
vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
pin most_far(int now, int n, vvel &way) {
	vel dist1 = dis(now, way);
	pin ans = mkp(-1, 0);
	rep(i, n) {
		if (dist1[i] > ans.first) { ans = mkp(dist1[i], i); }
	}
	return ans;
}

template<typename T>
V<T> uni(V<T> &v) {
	if (v.size() == 0) { return v; }
	sor(v);
	V<T> ans(1, v[0]);
	for (int i = 1; i < v.size(); i++) {
		if (v[i] != v[i - 1]) { ans.push_back(v[i]); }
	}
	v = ans;
	return v;
}
int s_gcd(int a, int b) {
	if (b == 0) { return a; }
	return s_gcd(b, a%b);
}
int gcd(int a, int b) {
	a = abs(a);
	b = abs(b);
	if (a < b) { swap(a, b); }
	return s_gcd(a, b);
}
signed main(){
	int n, k; cin >> n >> k;
	vel a(n);
	rep(i, n) { cin >> a[i]; }
	int count1 = 0;
	int count2 = 0;
	rep(i, n) {
		rep(j, n) {
			if (a[i] > a[j]) {
				count2++;
				if (i < j) { count1++; }
			}
		}
	}
	count1 %= p;
	count2 %= p;
	count1 *= k; count1 %= p;
	int mul = (k*(k - 1)) / 2;
	mul %= p;
	count2 *= mul; count2 %= p;
	cout << (count1 + count2) % p << endl;
}

Measured memory_bytes: 256
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n, x, t;
        cin >> n >> x >> t;

        cout << (n + x - 1) / x * t << '\n';
        
    }
    
    return 0;
}



Measured memory_bytes: 3664
using System;
using System.Collections.Generic;

class AIDU0500
    {
        static int pa=0,pb=0;

        static List<string> res=new List<string>();

        public static void Main(){
            int a,b,i;
            string s;   string[] ss= new string[2];
            while(true) {
                pa =0;pb=0;
                int n= int.Parse(Console.ReadLine());
                if(n==0)break;
                for(i=0;i<n;i++) {
                    s=Console.ReadLine();
                    if(string.IsNullOrEmpty(s))break;
                    ss=s.Split();
                    a=int.Parse(ss[0]);b=int.Parse(ss[1]);
                    Compare(a, b);
                }
                res.Add(string.Format("{0} {1}",pa,pb));
            }
            foreach(string res1 in res) Console.WriteLine(res1);
        }

        public static void Compare(int a,int b) {
            switch(Math.Sign(a-b)) {
                case 1:
                    pa+=a+b;break;
                case -1:
                    pb+=a+b;break;
                case 0:
                    pa+=a;pb+=b;break;
                default:break;
            }
        }
    }

Measured memory_bytes: 9372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

ll N;


int main(){
	cin >> N;
	map<string,int> m;
	for ( int i = 0; i < N; i++ ){
		string s;
		cin >> s;
		m[s]++;
	}
	
	int max_n = 0;
	for ( auto it : m ){
		max_n = max(max_n, it.second);
	}
	
	vector<string> v;
	for ( auto it : m )
		if ( it.second == max_n )
			v.push_back(it.first);
	
	sort(v.begin(),v.end());
	for ( auto it : v )
		cout << it << "\n";
	
	return 0;
}



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

int main()
{
        string S;
        cin >> S;
        int num = 0,keep=0;
        bool fl = true;

        if(S[0]=='A'){
                for(int i=2; i<S.size()-1; i++){
                        if(S[i]=='C'){
                                num++;
                                keep = i;
                        }
                }
                if(num == 1){
                        for(int i=1; i<S.size(); i++){
                                if(i != keep && S[i]>='A' && S[i]<='Z'){
                                        fl = false;
                                }
                        }
                }else fl = false;
        }else fl = false;

        if(fl == true) cout << "AC" <<endl;
        else cout << "WA" <<endl;

        return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //input
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        String []ss = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
        List<String> list = new ArrayList<>();
        for (int i=0;i<ss.length;++i)
        {
            list.add(ss[i]);
        }

        StringBuilder stb = new StringBuilder("");
        for (int i=0;i<s.length();++i)
        {
            String s1 = s.substring(i,i+1);
            int ind = list.indexOf(s1)+n;
            if (ind >= list.size())
            {
                ind = ind - 26;
                stb.append(list.get(ind));
            }else
            {
                stb.append(list.get(ind));
            }
        }

        System.out.println(stb.toString());
        sc.close();
    }

    public class Pair<F,S>
    {
        private final F first;
        private final S second;

        Pair(F first,S second)
        {
            this.first = first;
            this.second = second;
        }

        public void print() { System.out.println("("+this.first+","+this.second+")"); }

        //get
        public F first() {return this.first;}
        public S second() {return this.second;}

        @Override
        public boolean equals(Object object)
        {
            if (object instanceof Pair)
            {
                Pair pair = (Pair)object;
                return this.first==pair.first && this.second==pair.second;
            }else
            {
                return false;
            }
        }

        @Override
        public int hashCode()
        {
            return Objects.hash(first,second);
        }
    }
}

Measured memory_bytes: 22868
#include <iostream>
#include <vector>

int main(){
	int x;
	std::cin >> x;
	int n=100005;
	std::vector<int> a(n);
	for(int i=1; i<=n; i++){
		a[i] = i;
	}
	std::vector<int> p;
	for(int j=2; j<=n; j++){
		if(a[j]!=0){
			p.push_back(j);
			if(j>=x){
				std::cout << j;
				return 0;
			}
		}
		for(int k=j; k<=n; k+=j){
			a[k]=0;
		}
	}
	return 0;
}


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


int main() {
    ll c=0;

    string s;
    cin >> s;

    ll ans=0;
    REP(i,s.size()){
        if(s[i]=='T') c++;
        else  c--;

        chmax(ans,c);
    }

    pl(ans*2)

    return 0;
}


Measured memory_bytes: 640
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k; cin >> k;
    vector<int> as(k);
    for(int i = 0; i < k; i++){
        cin >> as[i];
    }
    reverse(as.begin(), as.end());
    ll l = 2, r = 2;
    for(int i = 0; i < k; i++){
        int a = as[i];
        l = (l + a - 1) / a * a;
        r = r / a * a + a - 1;
        printd(l, r);
        if(l > r){
            cout << -1 << '\n';
            return 0;
        }
    }
    cout << l << ' ' << r << '\n';
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>

using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int N,M;
    int L[200000],R[200000],D[200000];
    cin>>N>>M;
    rep(i,M) cin>>L[i]>>R[i]>>D[i];
    vector<pair<int,int>> vec[100000];
    rep(i,M){
        vec[L[i]-1].push_back(make_pair(R[i]-1,D[i]));
        vec[R[i]-1].push_back(make_pair(L[i]-1,-1*D[i]));
    }
    bool done[100000];
    int pos[100000];
    queue<int> que;
    int now,next;
    rep(i,N){
        if(done[i]) continue;
        pos[i]=0;
        done[i]=true;
        que.push(i);
        while(!que.empty()){
            now=que.front();
            que.pop();
            while(!vec[now].empty()){
                next=vec[now].back().first;
                if(done[next]) {
                    vec[now].pop_back();
                    continue;
                }
                done[next]=true;
                pos[next]=pos[now]+vec[now].back().second;
                que.push(next);
                vec[now].pop_back();
            }
        }
    }
    rep(i,M){
        if((pos[R[i]-1]-pos[L[i]-1])!=D[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 11776
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
//#include <unordered_map>
#include <stack>

using namespace std;

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

int N;

int main() {

	cin >> N;
	vector<int> P;

	rep(i, N) {
		int p;
		cin >> p;
		P.push_back(p);
	}

	int ans = 0;

	int min = P[0];

	rep(i, N) {
		if (P[i] <= min) {
			ans++;
			min = P[i];
		}
	}

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


Measured memory_bytes: 1400
#include <cstdio>
#include <map>

using namespace std;

map <pair<int, int>, int> mp[200000];

bool check(pair<int, int> p, int da, int db) {
    int a = p.first + da;
    int b = p.second + db;
    
    if (a + b < 0) return false;
    
    return mp[a + b].count(make_pair(a, b));
}

bool before(pair<int, int> p) {
    return check(p, -1, -1) || check(p, -1, 0) || check(p, -1, 1);
}

bool after(pair<int, int> p) {
    return check(p, -1, -1) || check(p, 0, -1) || check(p, 1, -1);
}

int solve() {
    int n, d, ans, i;
    map <pair<int, int>, int>::iterator it, it2;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        int a, b;
        
        scanf("%d %d", &a, &b);
        
        if (i == 0) {
            if (a != 0 || b == 0) return -1;
            
            d = b;
        } else if (i == 1) {
            if (a != d || b != 0) return -1;
        } else {
            if (a == 0 || b == 0 || a + b < d) return -1;
        }
        
        mp[a + b][make_pair(a, b)]++;
    }
    
    ans = n * 2 - 2;
    
    for (i = d; i < n * 2; i++) {
        int c;
        
        if (mp[i].size() == 0) continue;
        
        for (it = mp[i].begin(); it != mp[i].end(); it++) {
            int c2 = it->second;
            
            if (!before(it->first) && it->first.first > 0) return -1;
            if (!after(it->first) && it->first.second > 0) return -1;
            
            if (it != mp[i].begin()) {
                it2 = it;
                it2--;
                
                if (it2->first.first + 1 == it->first.first) {
                    ans -= min(it->second, c);
                    c2 -= min(it->second, c);
                }
            }
            
            if (check(it->first, -1, -1)) {
                ans -= c2;
                c = it->second - c2;
            } else {
                c = it->second;
            }
        }
    }
    
    return ans;
}

int main() {
    printf("%d\n", solve());
    
    return 0;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define rev(a,b,c) for(int a=b;a>=c;a--)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define F first
#define S second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define get(a) cin>>a
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n";
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll ncr(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%mod;
    }
    return C[k];
}
void solve()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll x=abs(a-b);
    ll x1=min(a,b);
    ll x2=max(a,b);
    ll an1=x1-1;
    ll ann1=an1;
    an1+=(x2-ann1-1)/2;
    if((x2-ann1-1)%2) an1++;
    ll an2=n-x2;
    ll ann2=an2;
    an2+=(n-x1-ann2)/2;
    if((n-x1-ann2)%2) an2++;
    //deb(an1);
    //deb(an2);
    ll an=min(an1,an2);
    if(x%2==0){
        an=min(an,x/2);
    }
    pr(an);
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
       // nextl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
const int N=1e6+5;
typedef pair<int,int> pa;
vector <pair<int,int> > a[maxn];
int b[maxn];
int c[maxn];
void dfs(int i,int fa,int se)
{
    int s=a[i].size();
    int ff=1;
    for(int j=0;j<s;j++){
        if(a[i][j].first!=fa){
            if(ff==se) ff++;
            c[a[i][j].second]=ff;
            dfs(a[i][j].first,i,ff);
            ff++;
        }
    }
}
int main()
{
    int n,f,t;
    scanf("%d",&n);
    int cmax=0;
    for(int i=1;i<n;i++){
        scanf("%d%d",&f,&t);
        a[f].push_back(pa{t,i});
        a[t].push_back(pa{f,i});
        b[f]++;
        b[t]++;
        cmax=max({cmax,b[f],b[t]});
    }
    dfs(1,1,0);
    printf("%d\n",cmax);
    for(int i=1;i<n;i++){
        printf("%d\n",c[i]);
    }
    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for(int i = (s); i < (e); i++)
#define FOE(i, s, e) for(int i = (s); i <= (e); i++)
#define FOD(i, s, e) for(int i = (s); i >= (e); i--)
#define ll long long

int A[100005], B[100005], n;

map<int, int> M;

int main ()
{
	scanf("%d", &n);
	FOR(i, 0, n) { scanf("%d", &A[i]); B[i] = A[i]; }
	
	sort(B, B + n);
	
	FOR(i, 0, n) M.insert(make_pair(A[i], i % 2));
	
	int ans = 0;
	FOR(i, 0, n)
	{
		if (i % 2 != M.find(B[i]) -> second) ans++;
	}
	
	printf("%d\n", ans / 2);
	return 0;
}

Measured memory_bytes: 5760
def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))

    dp = [0] * N
    for i in range(1, N):
        # 現在の足場を1~K前の足場から求める
        dp[i] = min([dp[j] + abs(h[j]-h[i]) for j in range(max(0,i-K),i)])

    print(dp[-1])

if __name__ == '__main__':
    main()



Measured memory_bytes: 13980
import java.io.*;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    new Main().solve();
  }

  private void solve() {
    try(InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out)) {

      final int A = in.nextInt();
      final int B = in.nextInt();
      final int Q = in.nextInt();

      long[] s = new long[A+1];
      for (int i = 0; i < A; i++) {
        s[i] = in.nextLong();
      }
      s[A] = 1L << 40;

      long[] t = new long[B+1];
      for (int i = 0; i < B; i++) {
        t[i] = in.nextLong();
      }
      t[B] = 1L << 40;

      for (int q = 0; q < Q; q++) {
        long x = in.nextLong();
        long dist = 1L << 50;

        for (int c = 0; c < 2; c++) {
          long[] af = c == 0 ? s : t;
          long[] as = c == 0 ? t : s;

          for (int i = 0; i < 2; i++) {
            int posF = binarySearch(af, x) + i;
            long df = af[posF];

            for (int j = 0; j < 2; j++) {
              int posS = binarySearch(as, x) + j;
              long ds = as[posS];
              
              long d = Math.abs(x - df);
              d += Math.abs(df - ds);
              dist = Math.min(dist, d);
            }
          }
        }

        out.println(dist);
      }
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  private int binarySearch(long[] arr, long x) {
    int left = 0;
    int right = arr.length;

    while(right - left > 1) {
      int mid = (left + right) / 2;
      if(arr[mid] <= x)  left = mid;
      else right = mid;
    }
    return left;
  }

  static class InputReader implements AutoCloseable {
    static public BufferedReader br;
    static public StringTokenizer st;

    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream), 32768);
      st = null;
    }
    static public String next() {
      if (st == null || !st.hasMoreTokens()) {
        try { st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          throw new UncheckedIOException(e);
        }
      }
      return st.nextToken();
    }
    static public int nextInt() { return Integer.parseInt(next()); }
    static public long nextLong() { return Long.parseLong(next()); }
    static public int[] mapInt(int len) {
      int[] ret = new int[len];
      for (int i = 0; i < len; i++) ret[i] = Integer.parseInt(next());
      return ret;
    }
    static public long[] mapLong(int len) {
      long[] ret = new long[len];
      for (int i = 0; i < len; i++) ret[i] = Long.parseLong(next());
      return ret;
    }
    @Override public void close() throws IOException { br.close(); }
  }
}

Measured memory_bytes: 51872
require 'matrix'
include Math

EPS = 0.000001

def dist(x1, y1, z1, x2, y2, z2)
	sqrt((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)
end

loop do
	n = gets.to_i
	break if n == 0

	anchors = (1..n).map{gets.split.map &:to_f}
	max_h = -Float::INFINITY

	update_max_h = -> x, y, z do
		max_h = z if z > max_h && anchors.all?{|a, b, r| dist(x, y, z, a, b, 0) <= r + EPS}
	end
	
	anchors.each {|x, y, z| update_max_h[x, y, z]}
	
	anchors.combination(2) do |u, v|
		u, v = v, u if u[-1] < v[-1]
		(a1, b1, r1), (a2, b2, r2) = u, v
		d = hypot(a1-a2, b1-b2)
		l = (d + (r1**2 - r2**2) / d) / 2
		q = l / d
		next if q < 0 || 1 < q
		x = (1-q)*a1 + q*a2		
		y = (1-q)*b1 + q*b2
		z = sqrt(r1**2 - (x-a1)**2 - (y-b1)**2)
		update_max_h[x, y, z]
	end
	
	anchors.combination(3) do |(a1, b1, r1), (a2, b2, r2), (a3, b3, r3)|
		begin	
			x, y = *Matrix[
				[a1-a2, b1-b2],
				[a2-a3, b2-b3]
			].inv * Vector[
				(r2**2 - r1**2 + a1**2 - a2**2 + b1**2 - b2**2) / 2,
				(r3**2 - r2**2 + a2**2 - a3**2 + b2**2 - b3**2) / 2,
			]
		
			z = sqrt(r1**2 - (x-a1)**2 - (y-b1)**2)
		
			update_max_h[x, y, z]
		rescue
		end
	end

	p max_h
end

Measured memory_bytes: 9396
x,n=map(int,input().split())
if n==0:
    print(x)
    exit()
p=list(map(int,input().split()))
a=x
b=x
while a in p:
    a-=1
while b in p:
    b+=1
if abs(x-a)>abs(x-b):
    print(b)
elif abs(x-a)<abs(x-b):
    print(a)
else:
    print(min(a,b))

Measured memory_bytes: 9208
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    if(n == 1 && m == 1) {
        cout << 1 << endl;
        return 0;
    }

    if(n == 1 || m == 1) {
        cout << max(n, m) - 2 << endl;
        return 0;
    }

    cout << (n - 2) * (m - 2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	double H, h, max, min;
	scanf("%lf", &H);
	max=min=H;
	while(scanf("%lf", &h)!=EOF) {
		if(h<min) min=h;
		if(h>max) max=h;
		h=0;
	}
	printf("%.1f\n", max-min);
	return 0;
}


Measured memory_bytes: 652
import math
N = int(input())
for i in range(N):
	x1,y1,x2,y2,x3,y3 = map(float,input().split())
	
	x =((y1-y3)*(y1*y1 -y2*y2 +x1*x1 -x2*x2) -(y1-y2)*(y1*y1 -y3*y3 +x1*x1 -x3*x3)) / (2*((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3)))
	y =((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*x1 -x3*x3 +y1*y1 -y3*y3)) / (2*((x1-x3)*(y1-y2)-(x1-x2)*(y1-y3)))
	r = (x-x1)*(x-x1)+(y-y1)*(y-y1)
	print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,math.sqrt(r)))


Measured memory_bytes: 5672
#include <iostream>
#include <string>

using namespace std;

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

    int d[30]={0};
    bool can=true;
    for (int i=0;i<s.length();i++){
	int a=s[i]-97;
	if (d[a] == 0){
	    d[a]++;
	} else {
	    can=false;
	}
    }

    if (can) cout << "yes" << endl;
    else cout << "no" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int i,n,x;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        x=i;
        if(x%3==0){
            printf(" %d",i);
            continue;
        }
        do{
            if(x%10==3){
                printf(" %d",i);
                break;
            }
            x/=10;
        } while(x);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2052
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    
    class Program
    {
        

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int cnt_ba = 0;
            int cnt_a = 0;
            int cnt_b = 0;
            int ans = 0;

            for(int i = 0; i < N; i++)
            {
                
                string s = Console.ReadLine();

                bool left_b = false;
                bool right_a = false;

                for (int j = 0; j < s.Length; j++)
                {
                    if(j == 0 && s[j] == 'B')
                    {
                        left_b = true;                    }
                    if(j == s.Length - 1 && s[j] == 'A')
                    {
                        right_a = true;                        
                    }
                    if (j > 0 && s[j - 1] == 'A' && s[j] == 'B')
                    {
                        ans++;
                    }
                    
                }

                if (left_b)
                {
                    if (right_a)
                    {
                        cnt_ba++;
                    }
                    else
                    {
                        cnt_b++;
                    }
                }
                else if (right_a)
                {
                    cnt_a++;
                }

            }

            //Console.WriteLine($"a {cnt_a} b {cnt_b} ba {cnt_ba} ans {ans}");

            if(Math.Abs(cnt_a - cnt_b) > 0)
            {
                if (cnt_a > cnt_b)
                {
                    cnt_a -= cnt_b;
                    cnt_ba += cnt_b;
                    cnt_b = 0;
                }
                else
                {
                    cnt_b -= cnt_a;
                    cnt_ba += cnt_a;
                    cnt_a = 0;
                }
            }
            
            if(cnt_ba > 0)
            {
                ans += cnt_ba - 1;
            }


            if (cnt_ba > 0)
            {
                if(cnt_a > 0)
                {
                    ans++;
                    cnt_a--;
                }
                if(cnt_b > 0)
                {
                    ans++;
                    cnt_b--;
                }

            }

            ans += Math.Min(cnt_a, cnt_b);

            
            Console.WriteLine(ans);

        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>

using ull = unsigned long long;

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

    int k;
    std::cin >> k;

    ull t = 0;
    for (int i = 0; i < k; ++i) {
        int b;
        std::cin >> b;
        t += (1 << b);
    }

    for (ull d = 0; d < (1 << n); ++d) {
        if (d & ~t) continue;

        std::cout << d << ":";
        for (int i = 0; i < n; ++i)
            if (d & (1 << i)) std::cout << ' ' << i;
        std::cout << std::endl;
    }
}


Measured memory_bytes: 3108
inputs = str(input())
A = int(inputs.split()[0])
B = int(inputs.split()[1])
C = int(inputs.split()[2])
D = int(inputs.split()[3])


for i in range(100):
    C = C - B
    if C <= 0:
        text = "Yes"
        break
    A = A - D
    if A <= 0:
        text = "No"
        break

print(text)

Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s; 
  cin >>s;
  int a=0,b=0;
  for (int i=0;i<s.size();i++){
    if (s.at(i)=='0'){
      if (i%2==0)b++;
      else a++;
    }else if (s.at(i)=='1'){
      if (i%2==0)a++;
      else b++;
    }
  }
  cout<<min(a,b);
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe
    
int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
int a,b;
cin >> a >> b;
if (a==1)
{
    a +=13;
}
if (b==1){
    b += 13;
}

if (a>b)
{
    cout<<"Alice" << endl;
}else if (a<b){
    cout << "Bob" << endl;
}else
{
    cout << "Draw" << endl;
}






  
 
//////////////////////////////////////////////////////
return 0;}

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

int main(){
  long long N,ans=0;
  cin >> N;
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin >> S[i];
    sort(S[i].begin(),S[i].end());
  }
  sort(S.begin(),S.end());
  
  long long start=0,count1=0,count2=0;
  for(int i=1;i<N;i++){
    if(S[i]==S[start]){
      count1++;
      count2 += count1;
    }
    else{
      ans += count2;
      count1 = 0;
      count2 = 0;
      start = i;
    }
  }
  ans += count2;
  
  cout << ans << endl;
  return 0;
}


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

int main () {
    int N, K;
    cin >> N >> K;
    int s = 1;
    for (int i = 0; i < N; i++) {
        if (s * 2 < s + K) {
            s *= 2;
        }
        else {
            s += K;
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while(true) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}


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


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

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define x first
#define y second

using namespace std;

typedef pair<int, int> PII;

const int N = 2e5 + 10;

int n, m;
PII A[N];
int lim[N], c;

priority_queue<int, vector<int>, greater<int> > q;

int main(){
	
	scanf("%d%d", &n, &m);
	For(i, 1, n) scanf("%d%d", &A[i].x, &A[i].y);
	sort(A + 1, A + n + 1);

	int j = 0;
	For(i, 0, m){
		while(j < n && A[j + 1].x == i) q.push(A[++j].y);
		while(q.size() > i) lim[++c] = q.top(), q.pop();
	}
	int L = q.size(), ans = 0;

	For(i, 1, c) lim[i] = max(lim[i], L + 1);
	sort(lim + 1, lim + c + 1, greater<int>());

	j = 0;
	int now = 0;
	Forr(i, m + 1, L + 1){
		while(j < c && lim[j + 1] == i) ++now, ++j;
		if(now > m + 1 - i) ans += now - (m + 1 - i), now = m + 1 - i;
	}
	printf("%d\n", ans);

	return 0;
}

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

void show(vector<ll>& vc)
{
    for(auto it:vc)cout<<it<<" ";
    cout<<endl;
}
#define M 10
bool p[M+2];
vector<ll>prime;
void seive(void)
{
    memset(p,0,sizeof p);
    p[1]=1;
    p[0]=1;

    for(int i=4; i<=M; i+=2)
    {
        p[i]=1;

    }

    for(ll i=3; i*i<=M; i+=2)
    {

        if(!p[i])
        {

            for(ll j=i*i; j<=M; j+=2*i)
            {
                p[j]=1;

            }
        }
    }

    prime.push_back(2);
    for(int i=3; i<=M; i+=2)prime.push_back(i);
}
ll dx[] = {-1,-1,0,-1,1,0,1,1};
ll dy[] = {-1,0,-1,1,-1,1,0,1};

typedef pair<ll, ll> pii;
#define x first
#define y second


pii extendedEuclid(ll a, ll b)   // returns x, y | ax + by = gcd(a,b)
{
    if(b == 0) return pii(1, 0);
    else
    {
        pii d = extendedEuclid(b, a % b);
        return pii(d.y, d.x - d.y * (a / b));
    }
}

ll modularInverse(ll a, ll n)
{
    pii ret = extendedEuclid(a, n);
    return ((ret.x % n) + n) % n;
}

ll dp[100003][3];
ll n,arr[100003][3];
ll call(ll x, ll i)
{
    if(x==n)
    {
        return 0;
    }
    if(dp[x][i]!=-1)return dp[x][i];

    ll p = 0, q =  0;
    if(i==0)
    {
        p = arr[x][i] + call(x+1,1);
        q = arr[x][i] + call(x+1,2);
    }
    else if(i==1)
    {
        p = arr[x][i] + call(x+1,0);
        q = arr[x][i] + call(x+1,2);
    }
    else
    {
        p = arr[x][i] + call(x+1,0);
        q = arr[x][i] + call(x+1,1);
    }

    return (dp[x][i] = max(p,q));
}




void solve(ll t)
{

    memset(dp, -1, sizeof dp);
    cin>>n;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<3; j++)
        {
            cin>>arr[i][j];
        }
    }
    ll p = call(0,0);
    memset(dp, -1, sizeof dp);
    ll q = call(0,1);
    memset(dp, -1, sizeof dp);
    ll r = call(0,2);
    cout<<max(p,max(q,r))<<endl;



}


int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //seive();


    ll t=1;
    //cin>>t;
    ll T=t;



    while(t--)
    {


        solve(T-t);

    }
}


Measured memory_bytes: 9600
from collections import Counter

n = int(input())

v = list(map(int, input().split()))

odds = []
evens = []

for i in range(n):
    if i % 2 == 0:
        evens.append(v[i])
    else:
        odds.append(v[i])

evens_c = Counter(evens).most_common(2)
odds_c = Counter(odds).most_common(2)

if evens_c[0][0] != odds_c[0][0]:
    print(n - evens_c[0][1] - odds_c[0][1])
    exit()

if len(evens_c) == 1 or len(odds_c) == 1:
    print(n // 2)
    exit()

print(n - max(evens_c[0][1] + odds_c[1][1], evens_c[1][1] + odds_c[0][1]))


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

using namespace std;

int main() {

	
	string s;
	cin >> s;

	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(){
  int n=0, a[200005];
  cin>>n;

  for(int i=0;i<n;i++)
    cin>>a[i];

  int maxv=-2000000000;
  int minv=a[0];

  for(int i=1;i<n;i++){
      maxv = max(maxv,a[i]-minv);
      minv = min(minv,a[i]);
  }

  cout<<maxv<<endl;
  return 0;
}


Measured memory_bytes: 3896
import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt();
        while (n > 0) {
            int[] k = new int[n];
            for (int i = 0; i < n; i++) {
                k[i] = in.nextInt();
            }

            String s = in.next();
            int m = s.length();

            for (int i = 0; i < m; i++) {
                out.print(toChar((toIndex(s.charAt(i)) + 52 - k[i % n]) % 52));
            }
            out.println();

            n = in.nextInt();
        }

        out.flush();
    }

    private static int toIndex(char c) {
        if ('a' <= c && c <= 'z') {
            return c - 'a';
        } else {
            return c - 'A' + 26;
        }
    }

    private static char toChar(int index) {
        if (index < 26) {
            return (char) (index + 'a');
        } else {
            return (char) (index - 26 + 'A');
        }
    }

}



Measured memory_bytes: 32036
int sort(const void * a , const void * b){
   if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}

int main(void){
  int n,a[200000],i,s=0;
  
  scanf("%d",&n);
  
  for(i=0; i<n; i++)
    scanf("%d",&a[i]);
  
  qsort(a,n,sizeof(int),sort);
  
  for(i=0; i<n-1; i++) {
    if(a[i] == a[i+1]){
      s = 1;
    }
  }
  
  printf("%s",s ? "NO" : "YES");
  
  return 0;
}

Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>
int n, r[128];  //ASCII文字コードに対応させる
bool used[22370000];
char com[7], s[13];

int main()
{
   scanf("%d", &n);
   r[65] = 1;
   r[67] = 2;
   r[71] = 3;
   for(int i=0; i<n; i++){
      scanf("%s %s", com, s);
      int h = 0, l = strlen(s);
      for(int j=0; j<l; j++) h = h * 4 + r[s[j]];
      h += 1 << (2 * l);
      if(com[0] == 105) used[h] = true;
      else puts(used[h] ? "yes" : "no");
   }
}


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

using namespace std;

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

	int dp[100002][4];

	dp[1][0]=a[1],dp[1][1]=b[1],dp[1][2]=c[1];

	for(i=2;i<=n;i++)
	{
		dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2]=c[i]+max(dp[i-1][0],dp[i-1][1]);

	}

	printf("%d\n",max(dp[n][0],max(dp[n][1],dp[n][2])) );
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

int main() {
    string s, t;
    cin >> s >> t;
    if (s + t[t.length() - 1] == t) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}


Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#include <map>
#include <vector>
#include <algorithm>
#include <functional>

#include <sstream>
#include <iostream>

using namespace std;
typedef long long llint;
const llint inf = 1000000000000000000LL;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

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

  REP(a, N + 1) REP(b, M + 1) {
    int S = a * M + b * N - 2 * a * b;
    if (S == K) {
      puts("Yes");
      exit(0);
    }
  }

  puts("No");



  return 0;
}




Measured memory_bytes: 256
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    a, b, c = list(map(int, readline().split()))
    if a == b != c or a == c != b or b == c != a:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38256