akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;

namespace C
{
    class Solver
    {
        public void Solve()
        {
            int n = int.Parse(Console.ReadLine());
            int ans = 0;
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            for (int i = 0; i < n; i++)
            {
                ans += a[i] - 1;
            }
            Console.WriteLine(ans);
        }

    }

    class M
    {
        public static void Main(string[] args)
        {
            new Solver().Solve();
        }
    }

};


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

using ul = unsigned long long;
using ui = unsigned int;

using namespace std;

int main(void)
{
	ui N{ 0 };
	cin >> N;

	vector<ul> arrayA(N, 0);
	ul sum{ 0 };
	ul halfSum{ 0 };

	for (ui i = 0; i < N; ++i)
	{
		cin >> arrayA[i];

		sum += arrayA[i];
		if (i % 2 == 0)
		{
			halfSum += arrayA[i];
		}
	}

	// X_0の導出
	ul ans = halfSum * 2 - sum;
	cout << ans << " ";

	for (ui i = 0; i < N - 1; ++i)
	{
		// X_i = A_i * 2 - X_(i-1)
		ans = arrayA[i] * 2 - ans;
		cout << ans;

		if (i != N - 2)
		{
			cout << " ";
		}
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 2048
import java.util.Arrays;
import java.util.Scanner;

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

		for ( int i = 0; i < str.length; i++ )
		{
			str[ i ] = sc.next ();
		}

		new Main ().run ( str );
	}

	public void run ( String[] str )
	{
		Arrays.sort ( str , 0 , str.length );

		String result = "";

		for ( int i = 0; i < str.length; i++ )
		{
			result = result + str[ i ];
		}

		System.out.println ( result );
	}

}


Measured memory_bytes: 25036
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;


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



int main() {
	char ch[5];
	int a = 0, b = 0, c = 0;
	REP(i, 3) {
		cin >> ch[i];
		if (ch[i] == 'a') {
			a++;
		}
		if (ch[i] == 'b') {
			b++;
		}
		if (ch[i] == 'c') {
			c++;
		}
	}

	if (a == 1 && b == 1 && c == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	

	return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <stddef.h>
#include <stack>
#include <queue>

using namespace std;

void call(int n) {
	int i = 1;
CHECK_NUM:
	int x = i;
	if (x % 3 == 0) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
INCLUDE3:
	if (x % 10 == 3) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
	x /= 10;
	if (x) goto INCLUDE3;
END_CHECK_NUM:
	if (++i <= n) goto CHECK_NUM;

	cout << endl;
}

int main() {
	int n;
	int i = 1;
	int x;
	cin >> n;
	while (i <= n) {
		if (i % 3 == 0) {
			cout << ' ' << i;
			i++;
		}
		else {
			x = i;
			while (x >= 1) {
				if (x %10== 3) {
					cout << ' '<<i;
					break;
				}
				else x /= 10;
			}
			i++;
		}
	}
	cout << endl;

	
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <regex>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int A,B;
  cin>>A>>B;
  int cnt(1);
  int cnti(0);
  while (true){
    if (cnt>=B) {
      cout << cnti << endl;
      return 0;
    }
    cnt--;
    cnti++;
    cnt+=A; 
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100000];
int b[100000];
int ans=0;
int main(){
	int n,m;
	cin>>n>>m;
	for (int i=1;i<=m;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+m);
	for (int i=2;i<=m;i++)
	{
		b[i]=a[i]-a[i-1];
	}
	sort(b+2,b+1+m);
	for (int i=2;i<(m-n)+2;i++)
		ans+=b[i];
	cout<<ans;
	return 0;
}

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

using namespace std;

#define f first
#define s second
#define pb push_back
#define np next_permutation
#define bs binary_search
#define mp make_pair
#define all(x) x.begin(), x.end()
#define bp __builtin_popcountll
#define sqr(x) ((llong)sqrt (x))
#define b_ctz __builtin_ctzll
#define b_clz __builtin_clzll

#define y1 road_to_respa_top_6
#define prev road_to_respa_top_6
#define Abdrakhman abcdefghijklmnopqrstuvwxyzRakhman
#define left kotoriy_levee_chem_right
#define right kotoriy_pravee_chem_left

#define android ios_base::sync_with_stdio(0), cin.tie (0), cout.tie (0)
#define fn ""

typedef long long llong;
typedef long double ldouble;
typedef unsigned long long ullong;

typedef vector <int> vi;
typedef vector <string> vs;
typedef vector <vector <llong> > matrix;

typedef pair <llong, llong> pll;

typedef map <int, int> mii;

typedef set <llong> sl;

const int MXN = 1e6 + 1;
const llong MNN = 1e3 + 1;
const llong MOD = 1e9 + 7;
const int INF = 1e9;
const llong LINF = 1e18;
const llong MAGIC = 1000;
const ldouble EPS = 1e-9;
const ldouble PI = 3.1415926536;
const string TIME = "rovno_ushten_push_ketti";

inline llong log2 (llong x) {return 64 - b_clz (x) - 1;};
inline llong __lcm (llong a, llong b) {return a / __gcd (a, b) * b;}

int n, p;
int cnt[2];

llong ans;
llong c[51][51];

int main () {
    android;
    //freopen ("input.txt", "r", stdin);
    cin >> n >> p;
    for (int i = 0; i <= 50; i ++) {
        c[i][0] = c[i][i] = 1;
        for (int j = 1; j < i; j ++) {
            c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
        }
    }
    for (int i = 1; i <= n; i ++) {
        int x;
        cin >> x;
        cnt[x % 2] ++;
    }
    if (p) {
        for (int i = 1; i <= cnt[1]; i += 2) {
            for (int j = 0; j <= cnt[0]; j ++) {
                ans += c[cnt[1]][i] * c[cnt[0]][j];
            }
        }
    }
    else {
        for (int i = 0; i <= cnt[0]; i ++) {
            for (int j = 0; j <= cnt[1]; j += 2) {
                ans += c[cnt[1]][j] * c[cnt[0]][i];
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

char S[350][350];
int main(){
    int N;
    cin >> N;
    REP(i,N){
        REP(k,N){
            char s;
            cin >> s;
            //S[i][k] = s - 'a';
            S[i][k] = s;
        }
    }

    ll ans = 0;
    for(int x = 0; x < N; x++){
        bool ok = true;
        for(int i = 0; i < N; i++){
            for(int k = 0; k < N; k++){
                if(S[(i+x)%N][k] != S[(k+x)%N][i]){
                    ok = false;
                    goto next;
                }
            }
        }
next:
        if(ok) ans += N-x;
    }

    for(int y = 1; y < N; y++){
        bool ok = true;
        for(int i = 0; i < N; i++){
            for(int k = 0; k < N; k++){
                if(S[i][(k+y)%N] != S[k][(i+y)%N]){
                    ok = false;
                    goto next2;
                }
            }
        }
next2:
        if(ok) ans += N-y;
    }

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


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

#define fre freopen("in.txt","r",stdin)
#define ll long long
#define abs(x) ((x)>0?(x):-(x))
#define mod 1000000007
#define scand(x) scanf("%d",&x);
#define scanlld(x) scanf("%I64d",&x);
#define scans(x) scanf("%s",x);
#define printd(x) printf("%d",x);
#define printlld(x) printf("%I64d",x);
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf (1<<30)
#define forup(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define boost ios_base::sync_with_stdio(0)
#define MAXN 51
int a[MAXN],x[MAXN];
long long dp[51][51][2502];
int main()
{
    boost;
   // fre;
    int n,a;
    cin>>n>>a;
    forup(i,1,n+1)cin>>x[i];
    sort(x+1,x+n+1);
    forup(i,0,n+1)dp[i][0][0]=1;
    forup(i,1,n+1)
    {
        forup(j,1,i+1)
        {
            forup(sum,0,2501)
            {
                dp[i][j][sum]=dp[i-1][j][sum];
                if(sum>=x[i])dp[i][j][sum]+=dp[i-1][j-1][sum-x[i]];
            }
        }
    }
    long long ans=0;
    //forup(i,1,n+1){forup(j,1,i+1){forup(sum,0,34)cout<<dp[i][j][sum]<<" ";cout<<endl;}cout<<endl;}
    forup(i,1,n+1)
    {
        ans+=dp[n][i][a*i];
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 25600
N, M, Q = map(int, input().split())  # N個の駅, M本の電車, Q個のクエリ
X = [[0]*501 for _ in range(501)]
C = [[0]*501 for _ in range(501)]
for _ in range(M):
    left, right = map(lambda x: int(x)-1, input().split())
    X[left][right] += 1

for i in range(N):
    for j in range(N):
        # 累積和
        C[i][j] = C[i][j-1] + X[i][j]  # 横方向に累積されていく
for _ in range(Q):
    p, q = map(lambda x: int(x)-1, input().split())
    ans = 0
    for i in range(p, q+1):
        ans += C[i][q] - C[i][p-1]
    print(ans)


Measured memory_bytes: 58968
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define srtarr(x, n) sort(x, x+n)
#define dsrtarr(x, n) sort(x, x+n, greater<>());
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007

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;
}

using namespace std;
/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */


int p[20];
int main() {
    int n;
    cin >> n;
    rep(i,n)cin>> p[i];
    int ans = 0;
    reps(i, n - 2){
        int t = p[i];
        int ta[3];
        rep(j, 3){
            ta[j] = p[i+j-1];
        }
        srtarr(ta, 3);
        if(t == ta[1]) ans++;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
int t,n,k,d,A;
int main()
{
	cin>>t;
	while(t--&&cin>>n>>k)
	{
		while(n%k!=0)
			d=n/k+1,n-=((n-n/k*k-1)/d+1)*d;
		A^=n/k;
	}
	if(A)
		cout<<"Takahashi";
	else
		cout<<"Aoki";
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N-M+1):
    for j in range(N-M+1):
        ok = True
        for y in range(M):
            for x in range(M):
                if A[i+y][j+x] != B[y][x]:
                    ok = False
        if ok:
            print("Yes")
            exit()
print("No")

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

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


Measured memory_bytes: 3104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            int ans = 0;
            switch (s)
            {
                case "SUN":
                    ans = 7;
                    break;
                case "MON":
                    ans = 6;
                    break;
                case "TUE":
                    ans = 5;
                    break;
                case "WED":
                    ans = 4;
                    break;
                case "THU":
                    ans = 3;
                    break;
                case "FRI":
                    ans = 2;
                    break;
                case "SAT":
                    ans = 1;
                    break;
            }
            Console.WriteLine(ans);

        }
    }
}


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

using std::cin;
using std::cout;
using std::endl;

template<class T,class F>
struct segment_tree{
  std::vector<T> data;
  int n;
  F f;
  T identity;
  segment_tree(){}
  segment_tree(int sz,T ide,F _f):f(_f),identity(ide){
    n = 1;
    while(n<sz)n<<=1;
    data.resize(2*n,identity);
  }
  segment_tree(std::vector<T> const& v,T ide,F _f):f(_f),identity(ide){
    build(v);
  }
  void build(std::vector<T> const& v){
    int sz = v.size();
    n = 1;
    while(n<sz)n<<=1;
    data.resize(2*n,identity);
    for(int i=0;i<sz;++i)data[i+n]=v[i];
    for(int i=n-1;i>0;--i){
      auto x = f(data[i<<1|0],data[i<<1|1]);
      data[i]=x;
    }
  }
  void set(int i,T x){
    i += n;
    data[i] = x;
    while(i){
      i>>=1;
      data[i] = f(data[i<<1|0],data[i<<1|1]);
    }
  }
  T query(int l,int r)const{
    l += n, r += n;
    T x = identity;
    while(l<r){
      if(l&1)x = f(x,data[l++]);
      if(r&1)x = f(x,data[--r]);
      l>>=1, r>>=1;
    }
    return x;
  }
  T operator[](int i)const{
    return data[i+n];
  }
};
template<class T,class F>
auto make_segtree(int n,T ide,F f){
  return segment_tree<T,F>(n,ide,f);
}
template<class T,class F>
auto make_segtree(std::vector<T>const& v,T ide,F f){
  return segment_tree<T,F>(v,ide,f);
}

signed main(){
  int n;
  cin>>n;
  std::vector<int64_t> a(n);
  for(auto& ai:a)cin>>ai;
  auto gcd = [](auto a,auto b){
    while(1){
      if(a==0)return b;
      if(b==0)return a;
      a %= b;
      std::swap(a,b);
    }
  };
  auto seg = make_segtree<int64_t>(a,0,gcd);
  int64_t ans = 1;
  for(int i=0;i<n;++i){
    int64_t x = gcd(seg.query(0,i),seg.query(i+1,n));
    ans = std::max(ans,x);
  }
  cout<<(ans)<<endl;
}

Measured memory_bytes: 3072
import java.util.*;

public class Main {

	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		String n=sc.next();
	//System.out.println(n.length());
		int sum=0;
		for(int i=0;i<n.length();i++)
		{
			sum+=(int)n.charAt(i)-48;
		}
		
		if(sum%9==0) System.out.println("Yes");
		else System.out.println("No");
		
	}
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int m;
    cin >> m;
    cout << (24 - m) + 24 << endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)





int sx, sy, tx, ty;
//-----------------------------------------------------------------
int main() {
	cin >> sx >> sy >> tx >> ty;

	int w = ty - sy;
	int h = tx - sx;

	string ans = "";
	rep(i, 0, w) ans.push_back('U');
	rep(i, 0, h) ans.push_back('R');
	rep(i, 0, w) ans.push_back('D');
	rep(i, 0, h) ans.push_back('L');
	ans.push_back('L');
	rep(i, 0, w + 1) ans.push_back('U');
	rep(i, 0, h + 1) ans.push_back('R');
	ans.push_back('D');
	ans.push_back('R');
	rep(i, 0, w + 1) ans.push_back('D');
	rep(i, 0, h + 1) ans.push_back('L');
	ans.push_back('U');

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
bool overlap(int a, int b, int c, int d){
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}
 
int main(){
  int a, b, s, f, n;
  cin >> a >> b >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> s >> f;
    if ( overlap(a, b, s, f) ){
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 3096
import sys
from collections import Counter
from collections import deque
import math
import fractions
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a=list(map(str,input().split()))
ans=deque()
for i in range(n):
    if i%2==0:
        ans.append(a[i])
    else:
        ans.appendleft(a[i])
if n%2==1:
    ans=reversed(ans)
print(*ans)

Measured memory_bytes: 116684
#include <cstdio>

int k;
bool v[1000010];

int main()
{
	scanf("%d",&k);
	for(int i=1,now=7%k;;i++){
		if(v[now])return printf("-1"),0;
		if(!now)return printf("%d",i),0;
		v[now]=true;now=now*10+7;now%=k;
	}
}

Measured memory_bytes: 2708
import numpy as np

N = int(input())
a = np.zeros((2, N)).astype(int)
for i in range(2):
    a[i] = [int(_) for _ in input().split()]
    
dp = np.zeros((2, N)).astype(int)
dp[0][0] = a[0][0]
dp[1][0] = dp[0][0] + a[1][0]

for j in range(1, N):
    dp[0][j] = dp[0][j - 1] + a[0][j]
    dp[1][j] = max(dp[0][j], dp[1][j - 1]) + a[1][j]
    
print(dp[1][N-1])

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

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

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

    string s; cin >> s;

    if (s[1] == 'B') cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}


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

#define SIZE 1010
class TLcsSolver
{
    int FTable[SIZE][SIZE];
    const char* FArray1;
    const char* FArray2;
    const int Fn1;
    const int Fn2;

    int Count(int i, int j)
    {
        if(i == 0 || j == 0) return 0;
        if(FArray1[i-1] == FArray2[j-1]){
            return FTable[i-1][j-1] + 1;
        }
        return std::max(FTable[i-1][j], FTable[i][j-1]);
    }
    void Solve()
    {
        for(std::size_t i = 1; i < Fn1; ++i){
            for(std::size_t j = 1; j < Fn2; ++j){
                FTable[i][j] = Count(i, j);
            }
        }
    }
    void Print()const
    {
        for(std::size_t i = 0; i < Fn1; ++i){
            for(std::size_t j = 0; j < Fn2; ++j){
                printf("%d\t", FTable[i][j]);
            }
            printf("\n");
        }
    } 
public:
    TLcsSolver(const char* a, const char* b)
     : FArray1(a), FArray2(b)
     , Fn1(std::strlen(a)), Fn2(std::strlen(b))
    {
        Solve();
        // Print();
    }
    int Answer()const
    {
        return FTable[Fn1-1][Fn2-1];
    }
};

int main()
{
    int n;
    std::scanf("%d\n", &n);
    char a[SIZE];
    char b[SIZE];
    for(int i = 0; i < n; ++i){
        std::fgets(a, SIZE, stdin);
        std::fgets(b, SIZE, stdin);
        std::printf("%d\n", TLcsSolver(a, b).Answer());
    }
    return 0;
}

Measured memory_bytes: 6528
n = int(input())
a, b = map(int, input().split())
p = [int(m) for m in input().split()]
q = 0
r = 0
s = 0
for i in range(n):
    if p[i] <= a:
        q += 1
    elif p[i] <= b:
        r += 1
    else:
        s += 1
print(min(q, r, s))

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

int main() {
    int N,X,Y;
    cin >> N >> X >> Y;
    int ans[N] = {0};
    rep(i,0,N-1){
        rep(j,i+1,N){
            int d = min({j-i, abs(X-1-i) + 1 + abs(Y-1-j), abs(Y-1-i) + 1 + abs(X-1-j)});
            ans[d]++;
        }
    }

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

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


int main(){
  // 整数の入力
  int A,B,C,X;
  cin>>A>>B >> C>> X;

  int count = 0;
for(int i=0;i<=A;i++){
  for(int j=0;j<=B;j++){
    for(int k=0;k<=C;k++){
      int tmp = 500*i+100*j+50*k;
      if(tmp == X)count++;
    }

  }

}


  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}

var (
	ans  []int
	tree [][]int
)

func main() {
	n := nextInt()
	q := nextInt()

	tree = make([][]int, n)

	for index := 0; index < n-1; index++ {
		from, to := nextInt()-1, nextInt()-1

		tree[from] = append(tree[from], to)
		tree[to] = append(tree[to], from)
	}

	ans = make([]int, n)
	for index := 0; index < q; index++ {
		target, v := nextInt()-1, nextInt()
		ans[target] += v
	}
	dfs(0, -1)

	for _, item := range ans {
		fmt.Printf("%v ", item)
	}
	fmt.Println()
}

func dfs(n, from int) {
	for _, item := range tree[n] {
		if from == item {
			continue
		}
		ans[item] += ans[n]
		dfs(item, n)
	}
}


Measured memory_bytes: 49920
N=int(input())
a,b,c=map(int,input().split())
dp=[[0 for i in range(3)]for j in range(N)]
dp[0]=[a,b,c]
for i in range(1,N):
  A,B,C=map(int,input().split())
  dp[i]=[max(dp[i-1][1]+A,dp[i-1][2]+A),max(dp[i-1][0]+B,dp[i-1][2]+B),max(dp[i-1][0]+C,dp[i-1][1]+C)]
print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))

Measured memory_bytes: 70612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int x;
    cin >> x;
    vector<bool> prime(1e7);
    for(int i = 0; i < 1e7; i++) prime[i] = true;
    for(int i = 2; i < 1e7; i++)
    {
        if(prime[i])
        {
            for(int j = 2*i; j < 1e7; j += i)
            {
                prime[j] = false;
            }
        }
    }
    for(int i = x; i < 1e7; i++)
    {
        if(prime[i])
        {
            cout << i << endl;
            return 0;
        }
    }
}




Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef pair<int,int>P;
typedef long long ll;

int main(){
	int n;string s;cin>>n>>s;
	int r=0,b=0;
	for(char c:s){
		if(c=='R')r++;
		else b++;
	}
	if(r>b){
		puts("Yes");
	}
	else puts("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}
//char a[55][55];
int dx[] = {1,0,-1,0,1,1,-1,-1};
int dy[] = {0,1,0,-1,1,-1,-1,1};
ll a[100];
int main()
{
	dhoom;
	int n;
	cin >> n;
	int a[n];
	map< int , int > mp;
	int ans = 0;
	for(int i = 0 ; i < n ; i++){
		cin >> a[i];
		mp[a[i]]++;
	}
	for(auto it : mp){
		if(it.first > it.second)
			ans += it.second;
		if(it.first < it.second)
			ans += (it.second - it.first);	
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5120
#include <cstring>
#include <iostream>
#define p(c) (0 <= c && c < 10)
using namespace std;
int n, sx, sy, tx, ty; bool ok[11][10][10];
int main() {
	while (cin >> sx >> sy, sx + sy) {
		cin >> n; memset(ok, false, sizeof(ok));
		ok[0][sy][sx] = true;
		for (int i = 1; i <= n; i++) {
			cin >> tx >> ty;
			for (int j = 0; j < 1000; j++) {
				int x = j % 10, y = j / 10;
				if (!ok[i - 1][y][x]) continue;
				for (int l = -2; l <= 2; l++) {
					for (int m = -2; m <= 2; m++) {
						if (p(y + l) && p(x + m) && abs(ty - y - l) < 2 && abs(tx - x - m) < 2 && (abs(l) == 2 || abs(m) == 2) && abs(l * m) != 4) ok[i][y + l][x + m] = 1;
					}
				}
			}
		}
		int ret = 0;
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (ok[n][i][j]) ret = 1;
			}
		}
		cout << (ret ? "OK" : "NA") << endl;
	}
}

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

int main() {
    int n, m;
    cin >> n >> m;
    
    vector<int> a(m);
    vector<int> b(m);
    
    for (int i = 0; i < m; i++) {
        cin >> a.at(i) >> b.at(i);
    }
    
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (i + 1 == a.at(j) || i + 1 == b.at(j)) {
                ans.at(i)++;
            }
        }
    }
    
    for (int i = 0; i < n; i++) {
        cout << ans.at(i) << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100000 + 5
#define inf 10000000000000000
#define int long long 
#define rep(i, l, r) for(int i = l; i <= r; ++i)
int n, h, t, E, T, Min, x[N], q[N], dp[N];
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
signed main(){
    n = read(), E = read(), T = read();
    rep(i, 1, n) x[i] = read();
    q[h = t = 1] = 0, Min = inf;
    rep(i, 1, n) dp[i] = inf;
    rep(i, 1, n){
        while(h <= t && 2 * x[i] >= T + 2 * x[q[h] + 1]) Min = min(Min, dp[q[h]] - x[q[h]] - 2 * x[q[h] + 1]), h++;
        dp[i] = Min + 3 * x[i];
        if(h <= t) dp[i] = min(dp[i], dp[q[h]] - x[q[h]] + T + x[i]);
        while(h <= t && dp[i] - x[i] <= dp[q[t]] - x[q[t]]) t--;
        q[++t] = i;
    }
    printf("%lld", E - x[n] + dp[n]);
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmax(a,b) (a=max(a,b))
using namespace std;

struct apply{
  int l,r,p;
  apply(int a=0, int b=0, int c=0):l(a),r(b),p(c){}
  bool operator<(const apply x)const{return l<x.l;}
};

int dp[400][400];

int main(){
  int n;
  while(cin >> n, n){
    vector<apply> s(n);
    rep(i,n){
      int l,r,p;
      cin >> l >> r >> p; l--; r--;
      s[i] = apply(l,r,p);
    }
    sort(s.begin(),s.end());

    memset(dp,0,sizeof(dp));
    int id = 0;
    rep(i,365){
      while(id<n && s[id].l == i){
	int r = s[id].r, p = s[id].p;
	for(int j=365;j>=i;j--){
	  if(j<r+1){
	    chmax(dp[j][r+1],dp[i][j]+p);
	  }else{
	    chmax(dp[r+1][j],dp[i][j]+p);
	  }
	}
	id++;
      }

      chmax(dp[i+1][i+1],dp[i][i]);
      for(int j=i+1;j<=365;j++)chmax(dp[i+1][j],dp[i][j]);
    }
    cout << dp[365][365] << endl;
  }
}

Measured memory_bytes: 1840
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def calc_cost(plist, left, right):
    if left == right:
        return abs(plist[left])

    if plist[left] >= 0:
        return plist[right]

    if  plist[right] <= 0:
        return abs(plist[left])

    left_cost = abs(plist[left])
    right_cost = plist[right]
    return min(left_cost, right_cost) * 2 + max(left_cost, right_cost)


def main():
    n, k = intin()
    xlist = intina()

    min_cost = float('inf')
    for i in range(n - k + 1):
        min_cost = min(calc_cost(xlist, i, i + k - 1), min_cost)
    print(min_cost)


if __name__ == '__main__':
    main()


Measured memory_bytes: 15420
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N,K;cin>>N>>K;
  std::vector<int> v[1234567];
  for(int i=1;i<N;i++){
    int a,b;cin>>a>>b;a--;b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int k;
  for(int i=0;i<N;i++)if(v[i].size()==1)k=i;
  int ans=1;
  queue<int> que;
  que.push(k);
  std::vector<int> res1(1234567,0),used(1234567,0);used[k]++;
  while(que.size()){
    int q=que.front();que.pop();//cout<<q<<" "<<ans<<endl;
    int t=0;for(int a:v[q])t+=res1[a];
    ans*=K-res1[q]-t;ans%=MOD;
    for(int p:v[q]){
      res1[p]++;
      if(used[p])continue;used[p]++;

      que.push(p);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 53236
/* it was worth becoming a chemist */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const ll INF = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const db EPS = (db) 1e-9;
const db pi = acos(-1.0);
const int MAXN = 1e5 + 5;                  

int n;
ll L, a[MAXN];
    
    
int main() {
    
    cin >> n >> L;
    for (int i = 1; i <= n; i++) {
    	cin >> a[i];
    }
    for (int i = 1; i < n; i++) {
    	if (a[i] + a[i + 1] >= L) {
    		cout << "Possible\n";
    		for (int j = 1; j < i; j++) {
    			cout << j << '\n';	
			}
    		for (int j = n - 1; j > i; j--) {
    			cout << j << '\n';
    		}
    		cout << i;
    		return 0;
    	}
    }
	cout << "Impossible";
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC130(void);
void ABC131(void);
void ABC132(void);
void ABC133(void);
void ABC134(void);
void ABC135(void);
void ABC136(void);
void ABC137(void);
void ABC138(void);
void ABC139(void);

int main(void){
    ABC132();
}

void ABC132(){
    int n,i,ans=0;
    cin>>n;
    vector<int> vec(n);
    for(i=0;i<n;i++){
        cin>>vec[i];
    }
    for(i=1;i<n-1;i++){
        if(vec[i]>vec[i-1]&&vec[i]<vec[i+1])ans++;
        if(vec[i]<vec[i-1]&&vec[i]>vec[i+1])ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <climits>
using namespace std;
#define REP(i, n) for(int i=0; i<(n); i++)
#define SZ(x) ((int)(x).size())
typedef vector<string> VS;

int main() {
	int n; cin >> n;
	VS s(n); REP(i, n)cin >> s[i];

	for (char c = 'a'; c <= 'z'; c++) {

		int min = INT_MAX;
		REP(i, n) {
			int cnt = 0;
			REP(j, SZ(s[i])) {
				if (s[i][j] == c)cnt++;
			}
			min = min > cnt ? cnt : min;
		}

		REP(k, min)cout << c;

	}
	puts("");
}

Measured memory_bytes: 256
from collections import deque

class RollingHash():
    def __init__(self, s, base1=19683,base2=6561,mod1=2^61-1,mod2=2^61-1):
        self.mod1 = mod1
        self.mod2 = mod2
        self.s = s
        n = len(s)
        self.hash1 = [0]*(n+1)
        self.pow1 = [1]*(n+1)
        self.hash2 = [0]*(n+1)
        self.pow2 = [1]*(n+1)
        for i in range(n):
            self.hash1[i+1] = (self.hash1[i]*base1 + ord(s[i])) % self.mod1
            self.pow1[i+1] = (self.pow1[i]*base1) % self.mod1
            self.hash2[i+1] = (self.hash2[i]*base2 + ord(s[i])) % self.mod2
            self.pow2[i+1] = (self.pow2[i]*base2) % self.mod2

    def get(self, l, r):
        h1 = (self.hash1[r] - self.hash1[l] * self.pow1[r-l]) % self.mod1
        h2 = (self.hash2[r] - self.hash2[l] * self.pow2[r-l]) % self.mod2
        return (h1,h2)


n = int(input())
s = input()
rh = RollingHash(s,base1=1007,base2=2009,mod1=10**9+7,mod2=10**9+9)

for len_ in range(n//2,0,-1):
    ql = [(-1,-1)]*(len_-1)
    wait_q = deque(ql)
    hset = set()
    # print(len_)
    for i in range(n-len_+1):
        # print(s[i:i+len_])
        hs = rh.get(i,i+len_)
        if hs in hset:
            print(len_)
            exit()
        else:
            wait_q.append(hs)
            hset.add(wait_q.popleft())
        # print(wait_q)
        # print(hset)

else:
    print(0)

Measured memory_bytes: 95348
def inint(): return int(input())
def inlint(): return list(map(int, input().split()))
def infloat(): return float(input())
def inlffloat(): return list(map(float, input().split()))
def inl(): return list(input())
def putlint(): return "".join(list(map(str, ans)))

a,b,c,d = inlint()

a = a*b
b=c*d
if a>b:
    print(a)
else:
    print(b)


Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n + 1)
	b := make([]int, n)

	for i := 0; i < n + 1; i ++ {
		fmt.Scan(&a[i])
	}
	for i := 0; i < n; i ++ {
		fmt.Scan(&b[i])
	}

	s := 0

	for i := 0; i < n; i++ {
		if b[i] > a[i] {
			s += a[i]
			b[i] -= a[i]
			if b[i] > a[i + 1] {
				s += a[i + 1]
				a[i + 1] = 0
			} else {
				s += b[i]
				a[i + 1] -= b[i]
			}
		} else {
			s += b[i]
			a[i] -= b[i]
		}
	}

	fmt.Println(s)
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
int n;
int p[51];
int main(){
	cin>>n;
 	for(int i=1; i<=n; i++) cin>>p[i];
 	 int diff=0;
  	for(int j=1; j<=n; j++) diff+=(p[j]!=j);
  if(diff<=2) cout<<"YES\n";
  else cout<<"NO\n";
}

Measured memory_bytes: 256
W, H, N = map(int, input().strip().split(" "))
paint = [0] * 4
paint[0] = -1
paint[1] = W
paint[2] = -1
paint[3] = H

for i in range(N):
    x, y, a = map(int, input().strip().split(" "))
    if a == 1:
        paint[a-1] = max(paint[a-1], x)
    elif a == 2:
        paint[a-1] = min(paint[a-1], x)
    elif a == 3:
        paint[a-1] = max(paint[a-1], y)
    elif a == 4:
        paint[a-1] = min(paint[a-1], y)

s = 0
for x in range(W):
    for y in range(H):
        if x >= paint[0] and x < paint[1] and y >= paint[2] and y < paint[3]:
            s += 1

print(s)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep1(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define rep(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
#define N 105
#define pql priority_queue<ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define rev(a,n) reverse(a,a+n)
using namespace std;
ll gcd(ll a,ll b) {
    if(a%b==0) return b;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b) {
    return a*b/gcd(a,b);
}
ll a,b,c,d,sum,ans,ans1;
int main() {
	cin>>a>>b>>c>>d;
	sum=lcm(c,d),a--;
	ans=a/c+a/d-a/sum;
	ans1=b/c+b/d-b/sum;
	cout<<b-a-ans1+ans;
	return 0;
}

Measured memory_bytes: 3608
import heapq

n, m = list(map(int, input().split()))
tasks = []
for i in range(n):
    ai, bi = list(map(int, input().split()))
    tasks.append((-bi, i, ai))
tasks.sort(key=lambda x: x[2])    
prtasks = []
money = 0
j = 0
for i in range(1,m+1):
    for k in range(j,len(tasks)):
        if tasks[k][2] <= i:
            heapq.heappush(prtasks, tasks[k])
            j += 1
        else:
            break
    if not prtasks:
        continue
    work = heapq.heappop(prtasks)
    money += work[0]

print(-money)

Measured memory_bytes: 80984
from math import factorial,sqrt
from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter

import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
# 列ベクトルとかの受け取り
times = n
lists = []
for _ in range(times):
    lists.append(list(map(int,input().split())))  #table.append(input())とも書ける

# print(lists)
routes = list(permus(range(0,n)))
# print(len(routes))
res = 0
for rout in routes:
    for i,town in enumerate(rout):
        if i == 0:
            continue
        else:
            xi = lists[rout[i]][0]
            yi = lists[rout[i]][1]
            xj = lists[rout[i-1]][0]
            yj = lists[rout[i-1]][1]
            res += sqrt((xi -xj)**2 + (yi-yj)**2)

ans = res/len(routes)

print("{:.10f}".format(ans))

Measured memory_bytes: 17000
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define MAX_V 10000000
#define INF 100000000

int main(){
    int n, k; cin >> n >> k;
    vector<int> lis(n);
    for(int i = 0; i < n; i++){
        int mid; cin >> mid;
        lis[i] = mid;
    }
    sort(lis.begin(), lis.end());
    int a = 1, b = k;
    int ans = lis[b-1] - lis[a-1];
    int ans1 = ans;
    while(1){
        if(b == n){break;}
        int ans1 = lis[b] - lis[a];
        ans = min(ans, ans1);
        a++;
        b++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  vector<int> v(3);
  cin >> v[0] >> v[1] >> v[2];
  sort(v.begin(), v.end());
  cout << v[0] << " " << v[1] << " " << v[2] << endl;
}

Measured memory_bytes: 1216
#include <cstdio>
#include <utility>
#include <algorithm>
using namespace std;
pair <int,int> a[100004];
int n,i,j,Min,x;
long long s,b[100004];
int main()
{
    scanf ("%d", &n);
    for (i=1;i<=n;i++)
    {
        scanf ("%d", &x);
        a[i].first=x;
        a[i].second=i;
    }
    sort (a+1,a+n+1);
    a[0].second=0;
    a[0].first=0;
    i=n;
    Min=2000000000;
    while (i>=1)
    {
        j=i-1;
        if (a[i].second<Min)
            Min=a[i].second;
        s=0LL;
        while (a[i].second==a[j].second && j>=1)
        {
            if (a[j].second<Min)
                Min=a[j].second;
            else
                break;
            j--;
        }
        s=(1LL)*(n-j)*(a[i].first-a[j].first);
        b[Min]=0LL+b[Min]+s;
        i=j;
    }
    for (i=1;i<=n;i++)
        printf ("%lld\n", b[i]);
    return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

int main() {
    ll N, K;
    cin >> N >> K;
    ll ok = 0, ng = K + 1;
    while (llabs(ok - ng) > 1) {
        ll m = (ok + ng) / 2;
        ll i = 0, money = m, total = 0;
        while (i < N && money > 0 && total <= K) {
            total += money;
            money /= 2;
            i++;
        }
        if (total <= K) ok = m;
        else ng = m;
    }

    cout << ok << endl;
    return (0);
}



Measured memory_bytes: 3116
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define hh putchar(10)
#define ll long long


void Main()
{
    int n;cin>>n;
    int a[n+3],f=1;
    for(int i=0;i<n;++i)scanf("%d",&a[i]);
    sort(a,a+n);
    register int s=0;
    for(int i=0;i<n;++i){
        ++s;
        while(a[i]==a[i+1])
            ++s,++i;
        if(s&1);else {
            puts("NO");
            f=0;
            return ;
        }
        s=0;
    }

    if(f)puts("YES");
}




int main()
{
    Main();
    return 0;
}



Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define N 100003
using namespace std;

vector<int> adj[N];
int a[N];
int n;

void dfs(int u,int fa){
    a[u] = 0;
    int v,l = adj[u].size();
    for(int i=0;i<l;++i){
        v = adj[u][i];
        if(v==fa) continue;
        dfs(v,u);
        a[u] ^= a[v]+1;
    }
}

inline void read(int &x){
    x = 0;
    char c = getchar();
    while(c<'0'||c>'9') c = getchar();
    while(c>='0'&&c<='9'){
        x = (x<<3)+(x<<1)+(c^48);
        c = getchar();
    }
}

int main(){
    int u,v;
    read(n);
    for(int i=1;i<n;++i){
        read(u),read(v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1,0);
    printf(a[1]?"Alice\n":"Bob\n");
    return 0;
}

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

int main() {
  
  char a,b;
  cin >> a >> b;
  
  if ( ( a == 'H' && b == 'H' ) || ( a == 'D' && b == 'D' )){
    cout << 'H' << endl;
  }else{
    cout << 'D' << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;

using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int 			long long int
#define pll 			pair<ll , ll>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) {
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) {
	return mod_pow(a , mod-2);
}

void solve() {
    
    int n , k;
    
    int r , s , p;
    
    string t;
    
    cin >> n >> k;
    
    cin >> r >> s >> p;
    
    map<char , int> f;
    
    f['r'] = p;
    f['s'] = r;
    f['p'] = s;
    
    cin >> t;
    
    int dp[n+5] {};
    
    for(int i = 0; i < n; ++i) {
    	if(i-k >= 0) {
    		if(i - 2*k >= 0) {
    			if(t[i-k] != t[i]) {
    				dp[i] = dp[i-k] + f[t[i]];
    			}
    			else {
    				dp[i] = max(dp[i-k] , dp[i-2*k] + f[t[i]]);
    			}
    		}
    		else {
    			if(t[i-k] != t[i]) {
    				dp[i] = dp[i-k] + f[t[i]];
    			}
    			else {
    				dp[i] = max(dp[i-k] , f[t[i]]);
    			}
    		}
    		
    	}
    	else {
    		dp[i] = f[t[i]];
    	}
    }
    
    int sm = 0;
    
    for(int i = n-1; i >= 0 && k > 0; --k , --i) {
    	sm += dp[i];
    }
    
    cout << sm;
}       

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 4516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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


  // a + b - 1 <= n

  ll n,a,b;
  cin >> n >> a >> b;
  if(a+b-1>n || a*b < n){
    cout << -1 << endl;
    return 0;    
  }

  vector<int> ans;
  for(int i=b;i>=1;i--) ans.pb(i);
  int need = a-1;
  for(int i=b+1;i<=n;i++){
    deque<int> tans;
    tans.push_back(i);
    need--;
    int c=1;
    while(c<b && need < (n-i) && i<n){
      c++;i++;
      tans.push_front(i);
      //      cout << i << endl;
    }
    rep(j,tans.size()) ans.pb(tans[j]);
  }
  rep(i,n) cout << ans[i] << " \n"[i==n-1];
  
  return 0;
    

}


Measured memory_bytes: 3568
#include <algorithm>
#include <cmath>
#include <cstring>  // memset()
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define ll long long
#define For(i, a, b) for (int i = (int)(a), sz = (int)(b); i < sz; i++)
#define rFor(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(0), cin.tie(0)

const int MAX = 1e5 + 5;

int main() {
    IO;
    ll n, m, k, c = 0, ans = 0, x = 0, y = 0;
    cin >> n >> m >> k;
    vector<int> a(n), b(m);
    For(i, 0, n) cin >> a[i];
    For(i, 0, m) cin >> b[i];
    For(i, 0, n) {
        if (c + a[i] <= k)
            c += a[i];
        else
            break;
        x++;
    }
    ans = y = x--;
    For(i, 0, m) {
        while (x >= 0 && c + b[i] > k)
            c -= a[x--], y--;
        if (c + b[i] <= k)
            c += b[i], y++;
        else
            break;
        ans = max(ans, y);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 4784