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

struct Card{
  char mark;
  char value;
};

int main(){

  struct Card C1[101], C2[101],C3;
  int n, i, j, mini, flag = 0;
  char ch;

  scanf("%d%c", &n, &ch);

  for (i=0; i<n; i++){
    scanf("%c%c%c", &C1[i].mark, &C1[i].value,&ch);
  }

  for(i=0; i<n; i++){
    C2[i] = C1[i];
  }

  for(i=0; i<=n-1; i++){
    for(j=n-1; j>=i+1; j--){
      if(C1[j].value < C1[j-1].value){
        C3 = C1[j];
        C1[j] = C1[j-1];
        C1[j-1] = C3;
      }
    }
  }

  for(i=0; i<=n-1; i++){
    mini = i;
    for(j=i; j<=n-1; j++)
      if(C2[j].value < C2[mini].value) mini = j;
    if(mini != i) {
      C3 = C2[i];
      C2[i] = C2[mini];
      C2[mini] = C3;
    }
  }

  for(i=0; i<n; i++){
    if(i) printf(" ");
    printf("%c%c",C1[i].mark,C1[i].value);
  }
  printf("\n");
  printf("Stable\n");

  for(i=0; i<n; i++){
    if(i) printf(" ");
    printf("%c%c",C2[i].mark,C2[i].value);
    if(C1[i].mark == C2[i].mark) flag++;
  }
  printf("\n");
  if(flag == n) printf("Stable\n");
  else printf("Not stable\n");


  return 0;
}

Measured memory_bytes: 612
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a>b||k<a+1||a>b-2) {
			System.out.println(k+1);
		}
		else {
			k=k-a+1;
			if(k%2==0) {
				BigInteger ans=new BigInteger(b+"");
				ans=ans.add(new BigInteger(k/2-1+"").multiply(new BigInteger(b-a+"")));
				//ans(k/2-1)*(b-a);
				System.out.println(ans);
			}
			else {
				BigInteger ans=new BigInteger(b+"");
				ans=ans.add(new BigInteger(k/2-1+"").multiply(new BigInteger(b-a+"")));
				ans=ans.add(BigInteger.ONE);
				System.out.println(ans);
			}

		}
	}
}


Measured memory_bytes: 23764
//f(t, a) (t固定) : ____/----の形をしているから, (__の値b, --の値c, __の終わりd, --の始まりe)を適当に更新する.
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int x;
int k;
int r[100001];
int q;
int t[100000], a[100000];

int h(int i) {
	if (i & 1) return -1;
	return 1;
}

signed main() {
	int i;
	cin >> x >> k;
	for (i = 1; i <= k; i++) cin >> r[i];
	
	int b = 0, c = x, d = 0, e = x, j = 1;
	cin >> q;
	for (i = 0; i < q; i++) {
		cin >> t[i] >> a[i];
		for (; j <= k && r[j] <= t[i]; j++) {
			if (h(j) == -1) d = d + max(0LL, r[j] - r[j - 1] - b);
			b = min(x, max(0LL, b + h(j) * (r[j] - r[j - 1])));
			c = min(x, max(0LL, c + h(j) * (r[j] - r[j - 1])));
			e = d + (c - b);
		}
		
		int ans;
		if (a[i] <= d) ans = b;
		else if (a[i] <= e) ans = b + (a[i] - d);
		else ans = c;
		ans = min(x, max(0LL, ans + h(j) * (t[i] - r[j - 1])));
		cout << ans << endl;
	}
	return 0;
}

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

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

  int k;
  cin >> k;
  vector<ll> ans(100005, 0);
  queue<ll> q;
  rep(i, 1, 10) {
    ans[i] = i;
    q.push(i);
  }

  int cur = 10;
  while (cur < 100001) {
    ll t = q.front();
    q.pop();
    string ts = to_string(t);
    ts += ts[ts.size() - 1];
    ll x = stol(ts);

    if (t % 10 == 0) {
      ans[cur++] = x;
      ans[cur++] = x + 1;
      q.push(x);
      q.push(x + 1);
    } else if (t % 10 == 9) {
      ans[cur++] = x - 1;
      ans[cur++] = x;
      q.push(x - 1);
      q.push(x);
    } else {
      ans[cur++] = x - 1;
      ans[cur++] = x;
      ans[cur++] = x + 1;
      q.push(x - 1);
      q.push(x);
      q.push(x + 1);
    }
  }

  cout << ans[k] << endl;
}


Measured memory_bytes: 4776
#include <iostream>                                                                                                          

int main(){
   int A, B, C, D;
   std::cin >> A >> B >> C >> D;

   if(A+B==C+D) std::cout << "Balanced" << std::endl;
   else if(A+B>C+D) std::cout << "Left" << std::endl;
   else std::cout << "Right" << std::endl;

   return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

constexpr int MAX_N = 10050;

int c, n;
int d[MAX_N];				//d[i]: 剩余容量为 i 时最大价值 
int v[MAX_N], w[MAX_N];

int DP(int cur);

int main()
{
	scanf("%d%d", &n, &c);
	
	for (int i = 0; i < n; ++i)
	{
		scanf("%d%d", &v[i], &w[i]);
	}
	
	printf("%d\n", DP(c));
	
	return 0;
}

int DP(int cur)
{
	int & ans = d[cur];
	
	if (ans > 0)
	{
		return ans;
	}
	
	for (int i = 0; i < n; ++i)
	{
		if (cur >= w[i])
		{
			ans = max(ans, DP(cur - w[i]) + v[i]);
		}
	}
	
	return ans;
}


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

long long gcd(long long x, long long y){
	return x==0?y:gcd(y%x,x);
}

int main(){
	long long a,b,lcm;
	long long c,d,g;
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	g=gcd(c,d); lcm=1ll*c/g*d;
	long long c1=(b)/c-(a-1)/c,d1=(b)/d-(a-1)/d,lcm1=(b)/lcm-(a-1)/lcm;
//	printf("%lld : %lld\n%lld : %lld\n%lld : %lld\n",c,c1,d,d1,lcm,lcm1);
	printf("%lld\n",b-a+1-c1-d1+lcm1);
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
#else
#define print(...)
#endif


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

    ll a, b;
    string bs;
    
    cin >> a >> bs;

    string s;s += bs[0];
    for(int i=2; i<bs.length(); i++){
        s += bs[i];
    }
    b = stoll(s);

    print(a,b);

    ll ans = a*b/100;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;

ll M = 1000000007;

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    bool ok=true;
    if(n%2==0){
        rep(i,n/2){
            if(s[i]!=s[i+n/2]){
                ok=false;
            }
        }
    }else{
        ok=false;
    }
    if(ok){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

}

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

using namespace std;

int a[100005],b[100005],c[100005];
int dp[100005][3];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;++i)
	scanf("%d%d%d",a+i,b+i,c+i);
	for(int i=n;i>=0;i--)
	{
		for(int j=0;j<4;++j)
		{
				if(i == n)
				dp[i][j] = 0;
				else if(j == 0)
				{
					dp[i][j] = max(dp[i+1][1]+a[i],dp[i+1][2]+b[i]);
					dp[i][j] = max(dp[i][j],dp[i+1][3]+c[i]);
				}
				else if(j == 1)
				dp[i][j] = max(dp[i+1][3]+c[i],dp[i+1][2]+b[i]);	
				else if(j == 2)
				dp[i][j] = max(dp[i+1][3]+c[i],dp[i+1][1]+a[i]);	
				else
				dp[i][j] = max(dp[i+1][1]+a[i],dp[i+1][2]+b[i]);		
		}
	}
	printf("%d\n",dp[0][0]);
	return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,  int>;

const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

#define bit(n,k) ((n>>k)&1) /*nのk bit目*/

ll dp[22][1<<22];
int main(){
     int n;cin >>n;
     static vector<vector<int> > a(n, vector<int> (n)); 
     for(int i = 0; i < n; ++i){
         for(int j = 0; j < n; ++j){
              cin >>a[i][j];
         }
    }
     dp[0][0]=1;
     
     for(int S = 0; S < (1<<n); ++S){
         int i = __builtin_popcount(S);
         for(int j = 0; j < n; ++j){
             if(bit(S, j)==1 && a[i-1][j]==1){
                 dp[i][S]=(dp[i][S]+dp[i-1][S^(1<<j)])%MOD;
            }
         }
    }
    

   ll ans=dp[n][(1<<n)-1];
    
    cout << ans << endl;
}

Measured memory_bytes: 323840
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    int n,m; cin>>n>>m;
    pair<int,int> a[m]; rep(i,m) cin>>a[i].second>>a[i].first;
    sort(a,a+m);
    int left=-1,ans=0;
    rep(i,m){
        if(left<=a[i].second){
            left=a[i].first;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
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; }
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    int n=s.size();
    int ans=0;
    for (int i = 1; i < n/2; i++)
    {
        bool check=true;
        for(int j=0;j<i;j++){
            if(s[i+j]!=s[j]){
                check=false;
            }
        }
        if(check){
            chmax(ans,i);
        }
    }
    cout << ans*2 << "\n";
}


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

#define N 100000


int main(void){
    int n,v,total;
    int numbers[N][2];
    int max[2]={0,0};
    int maxsub[2]={0,0},maxnum[2]={0,0};
    for(int i=0;i<N;i++){
        numbers[i][0]=0;
        numbers[i][1]=0;
    }
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> v;
        if(i%2){
            numbers[v][0]++;
        }else{
            numbers[v][1]++;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<2;j++){
            if(max[j]<=numbers[i][j]){
                maxsub[j]=max[j];
                maxnum[j]=i;
                max[j]=numbers[i][j];
            }else if(maxsub[j]<numbers[i][j]){
                maxsub[j]=numbers[i][j];
            }
        }
    }
    if(maxnum[0]==maxnum[1]){
        if((max[0]+maxsub[1])>(max[1]+maxsub[0])){
            total=max[0]+maxsub[1];
        }else{
            total=max[1]+maxsub[0];
        }
    }else{
        total = max[0]+max[1];
    }
    //cout << max[0]<< " "<< maxsub[0] << endl;
    //cout << max[1]<< " "<< maxsub[1] << endl;
    cout << n-total << endl;
    return 0;
}

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

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

    int a, b;
    cin >> a >> b;
    if (a * b > a + b && a * b > a - b) {
        cout << a * b;
    } else if (a + b > a * b && a + b > a - b) {
        cout << a + b;
    } else {
        cout << a - b;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int x,y,a;
        int left = 0;
        int under = 0;
        int width = s.nextInt();
        int height = s.nextInt();
        int n = s.nextInt();
        
        for (int i = 0; i < n; i++) {
            x = s.nextInt();
            y = s.nextInt();
            a = s.nextInt();

            switch (a) {
                case 1:
                    if (left < x) {
                        left = x;
                    }
                    break;
                case 2:
                    if (width > x) {
                        width = x;
                    }
                    break;
                case 3:
                    if (under < y) {
                        under = y;
                    }
                    break;
                case 4:
                    if (height > y) {
                        height = y;
                    }
                    break;
            }
        }

        if (width < left || height < under) {
            System.out.println(0);
        } else {
            System.out.println((width-left) * (height-under));
        }
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
const int INF = 1000000000;
typedef pair<int, int> P;
const int MAX_N = 1000000;
typedef int64_t ll;
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() {
	int N, M;
	cin >> N >> M;
	Graph t(N);
	rep(i, M) {
		int a, b;
		cin >> a >> b; a--; b--;
		t.at(a).push_back(b);
		t.at(b).push_back(a);
	}
	rep(i, N) {
		cout << t.at(i).size() << endl;
	}
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<62)-1
#define MAX 1000000000
signed main(){
    int N,M; cin>>N>>M;
    vector<vector<bool>> A(N,vector<bool>(N,1));
    rep(i,0,M){
        int X,Y; cin>>X>>Y;
        A[X-1][Y-1]=0;
        A[Y-1][X-1]=0;
    }
    rep(i,0,N) A[i][i]=0;
    vi F(N,-1);
    vii C(N,vi(2));
    rep(i,0,N){
        if(F[i]==-1){
            queue<pii> Q;
            Q.push(mp(i,0));
            F[i]=0;
            while(Q.size()>0){
                int X=Q.front().first,Y=Q.front().second;
                Q.pop();
                C[i][Y]++;
                rep(j,0,N){
                    if(A[X][j]){
                        if(F[j]==-1){
                            F[j]=1-Y;
                            Q.push(mp(j,F[j]));
                        }
                        else if(F[j]==Y){
                            cout<<-1<<endl;
                            return 0;
                        }
                    }
                }
            }
        }
    }
    vector<vector<bool>> dp(N+1,vector<bool>(N+1));
    dp[0][0]=1;
    rep(i,0,N){
        REP(j,0,N){
            if(dp[i][j]){
                dp[i+1][j+C[i][0]]=1;
                dp[i+1][j+C[i][1]]=1;
            }
        }
    }
    int ans=INF;
    REP(i,0,N){
        if(dp[N][i]){
            int X=i,Y=N-X;
            ans=min(ans,X*(X-1)/2+(Y-1)*Y/2);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 0;
		for (int i = 1; i <= n; i++) {
			if (i % 2 == 0) {
				continue;
			}
			int count = 0;
			for (int j = 1; j <= i; j++) {
				if (i % j == 0) {
					count++;
				}
			}
			if (count == 8) {
				result++;
			}
		}
		System.out.println(result);
		sc.close();
	}
}


Measured memory_bytes: 35648
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

COND = ((48.0, 'light fly'), (51.0, 'fly'), (54.0, 'bantam'),
        (57.0, 'feather'), (60.0, 'light'), (64.0, 'light welter'),
        (69.0, 'welter'), (75.0, 'light middle'), (81.0, 'middle'),
        (91.0, 'light heavy'), (float('inf'), 'heavy'))

for line in stdin:
    weight = float(line)

    for base, name in COND:
        if weight <= base:
            print(name)
            break

Measured memory_bytes: 4276
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  cout << (s.find('a', 0) != string::npos && s.find('b', 0) != string::npos && s.find('c', 0) != string::npos ? "Yes" : "No") << endl;
}

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

int main()
{
  ll n;cin>>n;
  ll a[n],b[n];
  for(ll i=0;i<n;i++){
    cin>>a[i];
    b[a[i]-1]=i+1;
  }
  sort(a,a+n);
  for(ll i=0;i<n;i++)cout<<b[a[i]-1]<<' ';
  cout<<endl;
  return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int n;
	cin >> n;
	ll res = 1LL;
	REP(i, 1, n + 1) (res *= i) %= MOD;
	cout<<res<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	set<char> Arare; Arare.clear();
	rep (i, N){
		char S; cin >> S;
		Arare.insert(S);
	} // end rep
	cout << (Arare.count('Y') ? "Four" : "Three") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<ll,ll> P;
//ll const INF=1001001001;
//ll const INF=1001001001001001001;
ll const MOD=1000000007;

int N,M,K;

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

    string ans="No";
    rep(i,N+1){
        rep(j,M+1){
            int cnt=i*(M-j)+j*(N-i);
            if(cnt==K){
                ans="Yes";
                goto a;
            }
        }
    }a:;

    cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
long long mod = 1e9 + 7;

int main(void) {

  int n, k; cin >> n >> k;
  vector<long long > v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  long long ans = 0;
  for(int g=0; g<=k; g++) {
    int p = k - g;
    if(p > n) continue;
    for(int l=0; l<=p; l++) {
      for(int r=0; r<=p; r++) {
        if(r + l > p) break;
        if(r + l >= n) r = n-l;
        priority_queue<long long> q;
        for(int i=0; i<l; i++) q.push(-v[i]);
        for(int i=0; i<r; i++) q.push(-v[n-i-1]);
        for(int i=0; i<g; i++) {
          if(q.empty()) break; 
          if(q.top() < 0) break;
          q.pop();
        }
        long long tmp = 0;
        while(!q.empty()) {
          tmp -= q.top();
          q.pop();
        }
        ans = max(ans, tmp);
      }
    }
  }
  cout << ans << endl;  
  return 0;
}



// EOF


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

int main() {
	int a[4],b[4];
	while (cin >> a[0]>>a[1]>>a[2]>>a[3] >> b[0]>>b[1]>>b[2]>>b[3]) {
		int hit = 0;
		int blow = 0;
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (b[i] == a[j]) {
					if (i == j) hit++;
					else blow++;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

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


void solve(long long N, std::vector<std::string> S){
  std::sort(S.begin(), S.end());
   decltype(S)::iterator result = std::unique(S.begin(), S.end());

   S.erase(result, S.end());

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

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  std::vector<std::string> S(N);
  for(int i = 0 ; i < N ; i++){
    std::cin >> S[i];
  }
    solve(N, std::move(S));
    return 0;
}


Measured memory_bytes: 9532
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] ABK = str.split(" ");
        int cont = 0;
        for (int i=Math.min(Integer.parseInt(ABK[0]),Integer.parseInt(ABK[1]));i>0;i--){
            if (Integer.parseInt(ABK[0])%i==0 && Integer.parseInt(ABK[1])%i==0){
                cont++;
                if (cont==Integer.parseInt(ABK[2])){
                    System.out.println(i);
                    return;
                }
            }
        }
    }
}

Measured memory_bytes: 21332
M = 1000000007
n, k = map(int, input().split())
l = list(map(int, input().split()))
k1 = k
pos = []
neg = []
zero = []
for i in l:
    if i > 0: pos.append(i)
    if i < 0: neg.append(i)
    if i == 0: zero.append(i)
pos.sort(reverse = True)
neg.sort()


if k == 1:
    if len(pos) > 0: print(pos[0] % M)
    elif len(zero) > 0: print(0)
    else: print(neg[0] % M)
    exit(0)

check = 0
if k % 2 == 1:
    check = 1
    k -= 3

p1, p2 = 0, 0
n1, n2 = len(pos), len(neg)

ans = 1
ch1, ch2 = 1, 1
while 1:
    if k == 0: break
    
    if p1 + 1 >= n1: ch1 = 0 
    if p2 + 1 >= n2: ch2 = 0
    
    if ch1 and ch2:
        k -= 2
        t1 = pos[p1] * pos[p1 + 1]
        t2 = neg[p2] * neg[p2 + 1]
        if t1 >= t2:
            p1 += 2
            ans = (ans * t1) % M
        else:
            p2 += 2
            ans = (ans * t2) % M
    elif ch1:
        k -= 2
        t1 = pos[p1] * pos[p1 + 1]
        ans = (ans * t1) % M
        p1 += 2
    elif ch2:
        k -= 2
        t2 = neg[p2] * neg[p2 + 1]
        ans = (ans * t2) % M
        p2 += 2
    else: break

if k != 0:
    if len(zero) > 0: ans = 0
    else:
        ans = (ans * pos[p1]) % M
        ans = (ans * neg[p2]) % M
else:
    ch1, ch2 = 1, 1
    if check:
        if p1 + 2 >= n1: ch1 = 0 
        if p2 + 1 >= n2: ch2 = 0
        
        if ch1 and ch2:
            t1 = pos[p1] * pos[p1 + 1] * pos[p1 + 2]
            t2 = neg[p2] * neg[p2 + 1] * pos[p1]
            if t1 >= t2:
                ans = (ans * t1) % M
            else:
                ans = (ans * t2) % M
        elif ch1:
            t1 = pos[p1] * pos[p1 + 1] * pos[p1 + 2]
            ans = (ans * t1) % M
        elif ch2:
            if p1 < n1:
                t2 = neg[p2] * neg[p2 + 1] * pos[p1]
                ans = (ans * t2) % M
            else:
                if len(zero) > 0: ans = 0
                else:
                    tmp = []
                    for i in range(n):
                        if l[i] >= 0: tmp.append([l[i], 1])
                        else: tmp.append([-l[i], 0])
                    tmp.sort()
                    Ans = 1
                    for i in range(k1):
                        if tmp[i][1] == 1: Ans = (Ans * tmp[i][0]) % M
                        else: Ans = (Ans * tmp[i][0] * -1) % M
                    ans = Ans
        else:
            if len(zero) > 0: ans = 0
            else:
                t2 = neg[p2] * pos[p1] * pos[p1 + 1]
                ans = (ans * t2) % M
print(ans)

Measured memory_bytes: 115872
#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>
#include <numeric>
//#include <function>
using namespace std;
typedef long long unsigned int ll;

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

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


int main() {


  int A, B, C;
  cin >> A >> B >> C;
  bool flag = false;

  if (A < B){
    if (A < C && C < B) flag = true;
  }else{
    if (B < C && C < A) flag = true;
  }

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


Measured memory_bytes: 256
import Control.Applicative
import Data.List
import Control.Monad

isSquare x = let x' = (floor $ sqrt x) in x' ^ 2 == floor x

len xs ys = sum $ zipWith (\x y -> (abs $ x - y) ^ 2) xs ys

solve [] a = a
solve (x:[]) a = a
solve (x:xs) a = solve xs (a + b)
  where
  b = sum $ map (\t -> if t then 1 else 0) l
  l = map (isSquare.(len x)) xs

main = do
  [n, d] <- (map read).words <$> getLine
  xs <- replicateM n $ (map read).words <$> getLine
  print $ solve xs 0


Measured memory_bytes: 1020
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		double r = Math.toRadians(90);
		double x = 0, y = 0;
		while (true) {
			String[] str = in.next().split(",");
			if (str[0].charAt(0) == '0' && str[1].charAt(0) == '0') break;

			int d = Integer.parseInt(str[0]);

			x += d*Math.cos(r);
			y += d*Math.sin(r);

			r -= Math.toRadians(Double.parseDouble(str[1]));
		}

		out.println(x >= 0 ? (int)x : (int)Math.ceil(x));
		out.println(y >= 0 ? (int)y : (int)Math.ceil(y));
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 26156
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int dp[333][4010];
int main(){
    int n;
    string s;
    while(cin>>n>>s){
        ll ans=0;
        for(int i=n-1; i>=0; --i){
        	dp['R'-'A'][i]=dp['R'-'A'][i+1];
        	dp['G'-'A'][i]=dp['G'-'A'][i+1];
        	dp['B'-'A'][i]=dp['B'-'A'][i+1];
        	dp[s[i]-'A'][i]++;
        }
        for(int i=0; i<n; ++i){
        	for(int j=i+1; j+1<n; ++j){
        		if(s[i]==s[j]){
        			continue;
        		}
        		char c;
        		if(s[i]=='R'&&s[j]=='B'){
        			c='G';
        		}
        		else if(s[i]=='R' &&s[j]=='G'){
        			c='B';
        		}
        		else if(s[i]=='G' &&s[j]=='B'){
        			c='R';
        		}
        		else if(s[i]=='G' &&s[j]=='R'){
        			c='B';
        		}
        		else if(s[i]=='B' &&s[j]=='G'){
        			c='R';
        		}
        		else if(s[i]=='B' &&s[j]=='R'){
        			c='G';
        		}
        		ans+=dp[c-'A'][j+1];
        		if(j+(j-i)<n){
        			ans-=(s[j+(j-i)]==c);
        		}
        	}
        }
        printf("%lld\n",ans);
    }
  return 0;
}




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

using namespace std;
#define ll long long
#define dbug printf("I am here\n");
const int maxn = 2e5+100;

const ll inf = 1e18;

ll f(ll x){
    if(x % 4 == 1)return 1;
    if(x % 4 == 2)return x+1;
    if(x % 4 == 3)return 0;
    if(x % 4 == 0)return x;
}

int main()
{

    ll a , b;
    cin >> a >> b;
    cout << (f(b) ^ f(a) ^ a) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define sz(a) (int)(a).size()
     
    using namespace std;
     
    template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
    template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
    const int INF = 2e5+2;
    const long long hell = 998244353ll;
    
    void solve(){
          int n;
          cin>>n;
          vector<int>raw(n),arr(n);
          for(int i=0;i<n;i++){
           	cin>>raw[i];
           	arr[i]=raw[i];
          }
          sort(arr.begin(),arr.end());
          int cnt=0;
          for(int i=0;i<n;++i){
          	if(arr[i]!=raw[i]) cnt++;
          }         
          if(cnt==2||cnt==0){
           	cout<<"YES"<<endl;
          }else{
          	cout<<"NO"<<endl;
          }
    }

    int main(){
    	
    	ios_base::sync_with_stdio(0);cin.tie(0);
    	
    	int q=1;
    #ifdef LOCAL
      	cin>>q;
#endif
	while(q--){
	 solve();
	}

    #ifdef LOCAL
        cout << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
    #endif	
    	return 0;
    }

Measured memory_bytes: 256
from collections import deque
K = int(input())

que = deque(['1', '2', '3', '4', '5', '6', '7', '8', '9'])

while K:
    if K == 1:
        ans = que.popleft()
        break
    K -= 1
    v = que.popleft()
    if v[-1] == '0':
        que.append(v + '0')
        que.append(v + '1')
    elif v[-1] == '9':
        que.append(v + '8')
        que.append(v + '9')
    else:
        que.append(v + str(int(v[-1]) - 1))
        que.append(v + str(int(v[-1])))
        que.append(v + str(int(v[-1]) + 1))

print(ans)

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

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  }
}


Measured memory_bytes: 23764
N, M = [int(i) for i in input().split()]

def canMake(div):
    return (M//div) - (N-1) >= 1 

ans = 1
for i in range(1, M):
    if i * i > M:
        break
    if M % i != 0:
        continue
    a, b = i, M//i
    if canMake(a):
        ans = max(ans, a)
    if canMake(b):
        ans = max(ans, b)
print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner cin = new Scanner(System.in);
		
		int a,b;

		while(cin.hasNext())
		{
			a=cin.nextInt();
			b=cin.nextInt();
		
			String s = ((Integer)(a+b)).toString();
			System.out.println(s.length());
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <boost/math/common_factor_rt.hpp>

uint64_t A, B, C, D ;

int main(int argc, char const* argv[])
{
    std::cin >> A >> B >> C >> D;
    A --;
    uint64_t res = boost::math::lcm(C, D);
    uint64_t tmp0 = B/C-A/C;
    uint64_t tmp1 = B/D-A/D;
    uint64_t tmp2 = B/res-A/res;
    // std::cout << tmp0 << std::endl;
    // std::cout << tmp1 << std::endl;
        // if (i%C != 0 && i%D != 0) {
        //     ret++;
        // }
    std::cout << B-A-tmp0-tmp1+tmp2 << std::endl;
    // std::cout << tmp0+tmp1 << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    string n;
    
    cin >> n;
    for(int i = 0; i < n.size(); i++){
        if(n[i] == '1')
            cout << '9';
        else if(n[i] == '9')
            cout << '1';
        else
            cout << n[i];
    }
    cout << endl;
    
    return 0;
}


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

using namespace std;

using int64 = long long;

struct HopcroftKarp {
  vector< vector< int > > graph;
  vector< int > dist, match;
  vector< bool > used, vv;

  HopcroftKarp(int n, int m) : graph(n), match(m, -1), used(n) {}

  void add_edge(int u, int v) {
    graph[u].push_back(v);
  }

  void bfs() {
    dist.assign(graph.size(), -1);
    queue< int > que;
    for(int i = 0; i < graph.size(); i++) {
      if(!used[i]) {
        que.emplace(i);
        dist[i] = 0;
      }
    }

    while(!que.empty()) {
      int a = que.front();
      que.pop();
      for(auto &b : graph[a]) {
        int c = match[b];
        if(c >= 0 && dist[c] == -1) {
          dist[c] = dist[a] + 1;
          que.emplace(c);
        }
      }
    }
  }

  bool dfs(int a) {
    vv[a] = true;
    for(auto &b : graph[a]) {
      int c = match[b];
      if(c < 0 || (!vv[c] && dist[c] == dist[a] + 1 && dfs(c))) {
        match[b] = a;
        used[a] = true;
        return (true);
      }
    }
    return (false);
  }

  int bipartite_matching() {
    int ret = 0;
    while(true) {
      bfs();
      vv.assign(graph.size(), false);
      int flow = 0;
      for(int i = 0; i < graph.size(); i++) {
        if(!used[i] && dfs(i)) ++flow;
      }
      if(flow == 0) return (ret);
      ret += flow;
    }
  }

  void output() {
    for(int i = 0; i < match.size(); i++) {
      if(~match[i]) {
        cout << match[i] << "-" << i << endl;
      }
    }
  }
};

int main() {
  int X, Y, E;
  scanf("%d %d %d", &X, &Y, &E);
  HopcroftKarp bm(X, Y);
  for(int i = 0; i < E; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    bm.add_edge(a, b);
  }
  printf("%d\n", bm.bipartite_matching());
}


Measured memory_bytes: 3332
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;


int main(void){
	int N, M, d, c, x, y, z, a;
	cin >> N;
	map<long long, long long> mp;
	cin >> a >> d >> M;
	for(int i = 0; i < M; ++i){
		cin >> x >> y >> z;
		long long ay, az;
		if(mp.count(y)){
			ay = mp[y];
		}else{
			ay = a + d * (y-1);
		}
		if(mp.count(z)){
			az = mp[z];
		}else{
			az = a + d * (z-1);
		}
		if(x==0){
			mp[y] = az;
			mp[z] = ay;
		}else{
			mp[y] = az;
		}
	}

	int K;
	cin >> K;
	long long ak;
	if(mp.count(K)){
		ak = mp[K];
	}else{
		ak = a + d * (K-1);
	}

	cout << ak << endl;
	return 0;
}


Measured memory_bytes: 3120
import bisect
N,M,K = map(int, input().split())
A= list(map(int, input().split()))
B = list(map(int, input().split()))
for i in range(1,len(A)):
    A[i]+=A[i-1]
for i in range(1,len(B)):
    B[i]+=B[i-1]
honn=a=bisect.bisect(B,K)
for i in range(len(A)):
    s=K-A[i]
    if s>=0:
        a=bisect.bisect(B,s)
        if i+1+a>honn:
            honn=i+1+a
print(honn)

Measured memory_bytes: 40376
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const LL INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int h,w,k;
    cin >> h >> w >> k;    
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    --sx; --sy; --tx; --ty;
    vector<string> g(h);
    REP(i,h) cin >> g[i];
    auto toId=[&]( int i, int j, int v ) {
        return (i*w+j)*4+v;
    };
    auto ceilMod=[&]( LL x ) {
        return (x+k-1)/k*k;
    };
    vector<LL> dist(h*w*4,INF);
    MinHeap<pair<LL,LL>> q;
    auto push=[&]( int i, int j, int v, LL x ) {
        int id=toId(i,j,v);
        if ( dist[id]<=x ) return;
        dist[id]=x;
        q.emplace(x,id);
    };
    REP(v,4) push(sx,sy,v,0);
    while ( !q.empty() ) {
        LL d=q.top().first;
        LL id=q.top().second;
        q.pop();
        if ( dist[id]<d ) continue;
        int x=id/4/w;
        int y=id/4%w;
        int v=id%4;
        REP(nv,4) push(x,y,nv,ceilMod(d));
        {
            int nx=x+dx[v],ny=y+dy[v];
            if ( nx>=0&&nx<h&&ny>=0&&ny<w ) {
                if ( g[nx][ny]=='.' ) {
                    push(nx,ny,v,d+1);
                }
            }
        }
    }
    LL ans=INF;
    REP(v,4) chmin(ans,dist[toId(tx,ty,v)]);
    if ( ans==INF ) cout << -1 << '\n';
    else {
        cout << ceilMod(ans)/k << '\n';
    }
    return 0;
}


Measured memory_bytes: 44120
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
const long long MOD = 1000000007, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}
 

 
signed main(){
	int A,B;
	cin>>A>>B;
	if((A+B)%2)cout<<"IMPOSSIBLE"<<endl;
	else cout<<abs(A+B)/2<<endl;
}

Measured memory_bytes: 764
#include<cstdio>
#include<cstring>
#define N 524288
int m,n;
inline int max(int x,int y){return x<y?y:x;}
inline void add(int*h,int u,int v){for(h[u|=m]=v;u>>=1;h[u]=max(h[u<<1],h[u<<1|1]));}
inline int sum(int*h,int u)
{
	int v=0x80000000;
	for(u|=m;u;u>>=1)if(~u&1)v=max(v,h[u^1]);
	return v;
}
int a[N],b[N],g[2][N],h[2][N],i,u,v,x,y;char e[N],f[N];
int main()
{
	scanf("%d",&n);
	for(m=1;m<n+2;m<<=1);
	for(i=1;i<m<<1;i++)h[1][i]=0x80000000;
	for(i=1;i<=n;i++)scanf("%d",a+i),b[i]=u<a[i]?u=a[i],1:0;
	for(i=n;i;i--) 
	if(b[i])add(h[0],a[i],sum(h[0],a[i])+2),add(h[1],a[i],sum(h[1],a[i])+2);
	else add(h[0],a[i],max(0,sum(h[1],a[i])+1)),add(h[1],a[i],sum(h[0],a[i])+1);
	for(i=n;i;i--)b[i]+=b[i+1];
	if(sum(h[b[1]&1],0)<b[1])return 0*puts("-1");
	for(i=1,u=0,memcpy(g,h,sizeof h);i<=n;i++)
	if(add(h[0],a[i],0x80000000),add(h[1],a[i],0x80000000),a[i]<u&&x<=b[i+1]+y&&b[i+1]+y-x<=sum(h[b[i+1]+y-x&1],u)||u<a[i]&&x+1<=b[i+1]+y&&b[i+1]+y-x-1<=sum(h[b[i+1]+y-x&1^1],a[i]))u=u<a[i]?x++,a[i]:u,e[i]=48;
	else v=v<a[i]?y++,a[i]:v,e[i]=49;
	for(i=1,u=v=x=y=0;i<=n;i++)
	if(add(g[0],a[i],0x80000000),add(g[1],a[i],0x80000000),a[i]<u&&y<=b[i+1]+x&&b[i+1]+x-y<=sum(g[b[i+1]+x-y&1],v)||u<a[i]&&y<=b[i+1]+x+1&&b[i+1]+x+1-y<=sum(g[b[i+1]+x-y&1^1],v))u=u<a[i]?x++,a[i]:u,f[i]=48;
	else v=v<a[i]?y++,a[i]:v,f[i]=49;
	return 0*printf("%s\n",strcmp(e+1,f+1)<0?e+1:f+1);
}

Measured memory_bytes: 11776
N = int(input())

A = list(input().split())

if N==1:
    print(A[0])
else:
    side1 = A[0::2]
    side2 = A[1::2]
    if N%2==0:
        print(" ".join(side2[::-1]+side1))
    else:
        print(" ".join(side1[::-1]+side2))

Measured memory_bytes: 27044
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

// template <typename T> T abs(const T& v) { return v < 0 ? -v : v; }

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

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

  ll n = N;
  ll mns = 1000;
  for(ll i = 1; i * i <= N; ++i) {
    if(N % i == 0) {
      chmin(mns, max((ll)to_string(i).length(), (ll)to_string(N / i).length()));
    }
  }
  cout << mns << endl;

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Procon
{
  public Procon() {}
  static void Main(string[] agrs)
  {
    new Procon().Do();
  }

  Scanner cin;

  public void Do()
  {
    cin = new Scanner();
    int ab = cin.nextInt();
    int bc = cin.nextInt();
    cin.nextInt();

    Console.WriteLine(ab*bc/2);
  }
}

class Scanner
{
  string[] s;
  int i;
  int max_i;

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

  public string nextString()
  {
    if (i >= s.Length) 
    {
      s = Console.ReadLine().Split(' ');
      max_i = s.Length;
      i = 0;
      if (max_i == 0) 
      {
        return "";
      }
      return s[i++];
    } else 
    {
      return s[i++];
    }
  }

  public int nextInt()
  {
    return int.Parse(nextString());
  }


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

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

  public string[] arrayString()
  {
    return Console.ReadLine().Split(' ');
  }

  public int[] arrayInt()
  {
    string[] str = Console.ReadLine().Split(' ');
    int[] array = new int[str.Length];
    for (int i=0; i<str.Length; i++) 
    {
      array[i] = int.Parse(str[i]);
    }
    return array;
  }

  public long[] arrayLong()
  {
    string[] str = Console.ReadLine().Split(' ');
    long[] array = new long[str.Length];
    for (int i=0; i<str.Length; i++) 
    {
      array[i] = long.Parse(str[i]);
    }
    return array;
  }

  public double[] arrayDouble()
  {
    string[] str = Console.ReadLine().Split(' ');
    double[] array = new double[str.Length];
    for (int i=0; i<str.Length; i++) 
    {
      array[i] = double.Parse(str[i]);
    }
    return array;
  }
}


Measured memory_bytes: 13140
s=input()
k = list(s)
A,B,C,D = int(k[0]),int(k[1]),int(k[2]),int(k[3])

for a in range(2):
  for b in range(2):
    for c in range(2):

      if a == 0:
        op1 = '+'
      else:
        op1 = '-'

      if b == 0:
        op2 = '+'
      else:
        op2 = '-'

      if c == 0:
        op3 = '+'
      else:
        op3 = '-'

      if eval(str(A) + op1 + str(B) + op2 + str(C) + op3 + str(D)) == 7:
        g = str(A) + op1 + str(B) + op2 + str(C) + op3 + str(D) + '=7'

print(g)

Measured memory_bytes: 3064
N = int(input())
word_dict = {}
for _ in range(N):
    si = input()
    if si in word_dict:
        word_dict[si] += 1
    else:
        word_dict[si] = 1

M = int(input())
for _ in range(M):
    ti = input()
    if ti in word_dict:
        word_dict[ti] -= 1
    else:
        word_dict[ti] = -1
print(max([max(word_dict.values()), 0]))

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

#ifdef DEBUG
#define deb(...) cerr __VA_ARGS__
#else
#define deb(...)
#endif
using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	int n, k, ile=0;
	cin >> n >> k;
	
	for(int i=0; i < n; ++i)
	{
		int x;
		cin >> x;
		if(x >= k)
			++ile;
	}
	cout << ile;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int sum=0;
	if(a>b) sum+=b;
	else sum+=a;
	if(c>d) sum+=d;
	else sum+=c;
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;

const int INF = 1LL << 40;
const int N = 3001;
int dp[N][N] = {};
string s, t, ans = "";

void get(int n, int m) {
    if(n == 0 || m == 0)
        return;
    if(dp[n][m] > dp[n][m - 1] && dp[n][m] > dp[n - 1][m]) {
        ans = s[n] + ans;
        get(n - 1, m - 1);
    }
    else if(dp[n - 1][m] > dp[n][m - 1])
        get(n - 1, m);
    else
        get(n, m - 1);
}

signed main() {
    
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    s = '.' + s;
    t = '.' + t;
    
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            dp[i][j] = -INF;
            
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(s[i] == t[j])
                dp[i][j] = dp[i - 1][j - 1] + 1;
            else
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }
    
    get(n, m);
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define ll long long int 
#define endl '\n'
#define INF 1000000000
#define MOD 1000000007
#define MAX 100000000 
#define mp make_pair
#define pb push_back
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.length();i++)
    {
    	if(s[i]=='R')
    	{
    		int temp=0;
    		for(int j=i;j<s.length();j++)
    		{
    			if(s[j]=='R')
    			{
    				temp++;
    			}
    			else
    			break;
    		}
    		ans=max(ans,temp);
    	}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3648
#include <stdio.h>

#define INFTY 1000000002

void merge(int *,int,int,int);
void mergeSort(int *,int,int);

int n,sum = 0;

int main(){
  int i,s[500000],left,right;

  scanf("%d",&n);
  if(n > 500000)return 0;

  for(i = 0;i < n;i++){
    scanf("%d",&s[i]);
  }
  left = 0;
  right = n;
  
  mergeSort(s,left,right);
  
 for(i = 0;i < n;i++){
   if(i > 0)printf(" ");
   printf("%d",s[i]);
 }
 printf("\n%d\n",sum);
      
  return 0;
}

void merge(int s[],int left,int mid,int right){
  int i = 0,j = 0,k,n1,n2,L[250001],R[250001];
 
  n1 = mid - left;
  n2 = right - mid;
  for(i = 0;i < n1;i++){
    L[i] = s[left + i];
  }
  for(i = 0;i < n2;i++){
    R[i] = s[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k = left;k < right ;k++){
    if(L[i] <= R[j]){
      s[k] = L[i];
      i += 1;
      sum++;
    }
    else{
      s[k] = R[j];
      j += 1;
      sum++;
    }
  }
}

void mergeSort(int s[],int left,int right){
  int mid;
 
  if(left + 1 < right){
    mid = (left + right)/2;
    mergeSort(s,left,mid);
    mergeSort(s,mid,right);
    merge(s,left,mid,right);
  }
  
}



Measured memory_bytes: 5624