akhauriyash/Code-Regression huggingface dataset:
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    string s1, s2;
    cin >> s1 >> s2;

    int t = 0;

    ll ans = 1;

    for(int i = 0; i < n; i++){
        if(i != n - 1){
            if(s1[i] == s1[i + 1] && s1[i] != s2[i]){
                if(t == 0){
                    ans *= nPr(3, 2);
                    ans %= MOD;
                } else if(t == 1) {
                    ans *= 2;
                    ans %= MOD;
                } else {
                    ans *= 3;
                    ans %= MOD;
                }
                t = 2;
                i++;
            } else {
                if(t == 0){
                    ans *= 3;
                    ans %= MOD;
                } else if(t == 1){
                    ans *= 2;
                    ans %= MOD;
                } else {

                }
                t = 1;
            }
        } else {
            if(t == 1){
                ans *= 2;
                ans %= MOD;
            } else if(t == 0){
                ans *= 3;
                ans %= MOD;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
set<int> st[26];
const int INF = 1e7;

int main()
{
	rep(i,26)
	{
		st[i].insert(INF);
	}
	int N,Q;
	cin >> N;
	string S;
	cin >> S;
	rep(i,N)
	{
		st[S[i] - 'a'].insert(i);
	}
	cin >> Q;
	rep(i,Q)
	{
		int q;
		cin >> q;
		if (q == 1)
		{
			int j;
			char c;
			cin >> j >> c;
			j--;
			st[S[j] - 'a'].erase(j);
			st[c - 'a'].insert(j);
			S[j] = c;
		}
		else
		{
			int l,r;
			cin >> l >> r;
			l--; r--;
			int ans = 0;
			rep(i,26)
			{
				auto it = st[i].lower_bound(l);

				if (*it <= r) ans++;
			}
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 24196
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int x=t.size();
    int memo=-1;
    int count;
    for(int i=0;i<n-x+1;i++){
        count=0;
        for(int j=0;j<x;j++){
            if(s[i+j]=='?'||s[i+j]==t[j]){
                count++;
            }
        }
        //cout<<count<<endl;
        if(count==x){
            memo=i;
        }
        //cout<<memo<<endl;
    }

    if(memo==-1){
        cout<<"UNRESTORABLE"<<endl;
    }
    else{
    for(int i=0;i<n;i++){
        if(i==memo){
            for(int j=0;j<x;j++){
                s[i+j]=t[j];
            }
            i+=x-1;
        }
        else if(s[i]=='?'){
            s[i]='a';
        }
    }
    cout<<s<<endl;
    }
}



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

ll a;
ll n = 2;
string ans;

int main(){
    cin >> a;
    while(true){
        if((n/2)*(n/2+1)/2 >= a){
            a = (n/2)*(n/2+1)/2-a;
            break;
        }
        n += 2;
    }
    rep(i,n/2) ans.push_back(')');
    rep(i,n/2) ans.push_back('(');
    for(int i = n/2; i < n; i++){
        if(a == 0) break;
        if(a >= n/2-(i-n/2)){
            swap(ans[i],ans[i-(n/2-(i-n/2))]);
            a -= n/2-(i-n/2);
        } else{
            swap(ans[i],ans[i-a]);
            a = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3312
#include<bits/stdc++.h>
#define re register
#define int long long
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int n,a,b;
signed main(){
	a=read();b=read();
	printf("%lld",a*(a-1)/2+b*(b-1)/2);
}

Measured memory_bytes: 256
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    ll h,n;
    priority_queue<ll> pq;
    cin >> h >> n;
    rep(i, n) {
        ll t;
        cin >> t;
        pq.push(t);
    }

    while(!pq.empty()){
        ll attack = pq.top();
        h -= attack;
        pq.pop();
    }
    print(h>0 ? "No" : "Yes");
    
    return 0;
}


Measured memory_bytes: 1400
import sys
import math
n,h=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
a=[ab[i][0] for i in range(n)]
A=max(a)
b=[ab[i][1] for i in range(n) if ab[i][1]>A]
b=sorted(b,reverse=True)
cnt=0
for i in b:
  h-=i
  cnt+=1
  if h<=0:
    print(cnt)
    sys.exit()
print(cnt+math.ceil(h/A))

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

int main(){
  long x;  cin >> x;
  for(long a=100; a>-200; a--){
    for(long b=a-1; b>=-200; b--){
      if(pow(a, 5)-pow(b, 5) == x){
	cout << a << " " << b << endl;
	return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 4060
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

const int CMax = 100002;

int X, W, Y, Z, n, A[CMax], B[CMax], ats;

int main() {
    scanf("%d %d %d", &n, &Y, &Z);

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

    Y = A[n-1];
    ats = abs(Y - Z);

    if (n > 1) X = A[n-2];
    for (int i = n-2; i >= 0; i--) {
        if (abs(A[i] - Y) > ats && abs(A[i] - Y) <= abs(X - Y)) {
            ats = abs(A[i] - Y);
            X = A[i];
        }
    }

    printf("%d\n", ats);
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF = 1e9;
#define MOD = 1e9+7;
#define INF64 = 1e18;


SINT8 MAS[52][52];

using namespace std;

int main() {

	SINT32 H,W;

	cin >> H >> W;

	rep(i,1,H+1) {
		rep(j,1,W+1) {
			cin >> MAS[i][j];
		}
	}

	rep(i,1,H+1) {
		rep(j,1,W+1) {
			if ((MAS[i][j] == '#') 
			&& (MAS[i][j] != MAS[i-1][j]) 
			&& (MAS[i][j] != MAS[i+1][j]) 
			&& (MAS[i][j] != MAS[i][j-1]) 
			&& (MAS[i][j] != MAS[i][j+1])){
				cout << "No" << endl;
				return 0;
			}
		}
	}


	cout << "Yes" << endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));　//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/

/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Measured memory_bytes: 256
n=input()
a=int(n[0])
b=int(n[1])
c=int(n[2])
d=int(n[3])
if a+b+c+d==7:
	print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a+b+c-d==7:
	print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a+b-c+d==7:
	print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b-c-d==7:
	print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a-b+c+d==7:
	print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a-b+c-d==7:
	print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c+d==7:
	print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a-b-c-d==7:
	print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")	

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

bool check(int m, int *d, int k) {
    while (m) {
        int digit = m % 10;
        for (int i = k; i--;) {
            if (digit == d[i]) {
                return false;
            }
        }
        m /= 10;
    }
    return true;
}

int main() {
    
    int n, k, d[10];
    
    cin >> n >> k;
    for (int i = 0; i < k; i++) cin >> d[i];
    
    for (int m = n; ; m++) {
        if (check(m, d, k)) {
            cout << m << endl;
            break;
        }
    }
    
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
h = np.array(list(map(int,input().split())))
answer=0
start=0
i=0

while(max(h)>0):
    while(h[i]==0):
        i+=1
    start=i
    while(h[i]!=0 and i<N-1):
        i+=1
    if h[i]==0:
        h[start:i]=h[start:i]-1
    else:
        h[start:]=h[start:]-1
    answer+=1
    start=0
    i=0

print(answer)

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

int main() {
	
	int h, w; cin >> h >> w;
	vector<vector<char>> c(h+2, vector<char>(w+2));
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cout << c[i][j];
		}
		cout << endl;
		for (int j = 1; j <= w; j++) {
			cout << c[i][j];
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
def check(k, a, b):
    i = (k-a)//2
    return -(i+a)*(i-k) < a*b

q = int(input())
for i in range(q):
    a,b = map(int, input().split())
    if a == b:
        print(2*a-2)
        continue
    a,b = sorted([a,b])
    ans = a-1
    left = a
    right = 10**9

    while right-left > 1:
        mid = (right+left)//2
        if check(mid, a, b):
            left = mid
        else:
            right = mid
    ans += left-1
    print(ans)

Measured memory_bytes: 41008
//解法1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

const int MAX_N = 3010;
int N, T;
int dp1[MAX_N][MAX_N];  // 1 - indexed dp1[i][j] -- 1~i番目の料理でj分以内に完食できる美味しさの合計の最大値
int dp2[MAX_N][MAX_N];  // 1 - indexed dp2[i][j] -- i~N番目の料理でj分以内に完食できる美味しさの合計の最大値
int A[MAX_N], B[MAX_N]; // 1 - indexed

int main()
{
    scanf("%d %d", &N, &T);
    REP(i, 1, N+1) scanf("%d %d", &A[i], &B[i]);

    REP(i, 1, N+1) REP(j, 0, T) {
        dp1[i][j] = max(dp1[i][j], dp1[i-1][j]);
        int p = j + A[i];
        if(p < T) dp1[i][p] = max(dp1[i][p], dp1[i-1][j] + B[i]);

        int in = N+1-i;
        dp2[in][j] = max(dp2[in][j], dp2[in+1][j]);
        int q = j + A[in];
        if(q < T) dp2[in][q] = max(dp2[in][q], dp2[in+1][j] + B[in]);
    }

    /*
    printf("DP1:\n");
    REP(i, 1, N+1) {
        REP(j, 0, T) printf("%d ", dp1[i][j]);
        printf("\n");
    }
    printf("DP2:\n");
    REP(i, 1, N+1) {
        REP(j, 0, T) printf("%d ", dp2[i][j]);
        printf("\n");
    }
    */
    int res = 0;
    REP(i, 1, N+1) {
        int tmp = 0;
        REP(j, 0, T) {
            int k = T-1-j;
            tmp = max(tmp, dp1[i-1][j] + dp2[i+1][k]);
        }
        res = max(res, tmp + B[i]);
    }
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 70912
/*
ID: 5ak0
PROG:
LANG: C++11
*/

#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mpr make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;

int n, x;
deque <int> b;

int main(){
    #ifndef SAKO
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    #endif // SAKO
    ios_base::sync_with_stdio(0);


	cin >> n;
	for (int i = 1; i <= n; ++i){
        cin >> x;
        if (i % 2 == 1)
            b.push_front(x);
        else
            b.pb(x);
	}
	if (n % 2 == 1)
        for (int i = 0; i < b.size(); ++i)
            cout << b[i] << " ";
    else
        for (int i = b.size() - 1; i >= 0; --i)
            cout << b[i] << " ";
    return 0;
}


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

int main() {

	string txt;
	cin >> txt;
	int len = 0;

	len = txt.size();
	//len = strlen(txt.c_str());
	//cout << len;

	string str(txt);
	for (int i = 0; i < len; i++)
	{
		double amari = i % 2;
		if (amari == 0.0){
			cout << str[i];
		}
	}
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a>b)
	{
		cout<<"a > b"<<endl;
	}
	else if(a<b)
	{
		cout<<"a < b"<<endl;
	}
	else
		cout<<"a == b"<<endl;
}

Measured memory_bytes: 1156
S = list(input())
N = len(S)
ans = "Yes"
s = []
for i in range(N-1, -1, -1):
    s.append(S[i])
A = []
B = []
for i in range((N-1)//2):
    A.append(S[i])
for i in range((N+3)//2-1, N):
    B.append(S[i])
a = []
b = []
for i in range(len(A)-1, -1, -1):
    a.append(A[i])
    b.append(B[i])
if A != a or B != b or s != S:
    ans = "No"
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
  int n; int a; int sum; int black;  /*変数の宣言*/

  scanf("%d", &n);  /*一辺あたりのマス数nを入力*/
  scanf("%d", &a);  /*白に塗るマス数aを入力*/

  sum = n * n;  /*マス目の総数をsumに代入*/
  black = sum - a;  /*黒に塗るマス数をblackに代入*/

  printf("%d\n",black); /*黒に塗るマス数を出力*/

  return 0;
}


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

public class Main {
	public static void main(String args[]) {
		try (Scanner in = new Scanner(System.in)) {
			int A = in.nextInt();
			int B = in.nextInt();

			int[] a = new int[] { A + B, A - B, A * B, };
			Arrays.sort(a);

			System.out.println(a[2]);
		}
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b && a!=c) || (b==c && b!=a) || (c==a && c!=b ))
  {
    cout<<"Yes"<<endl;
  }
  else
  {
      cout<<"No"<<endl;
  }
  return 0;
}


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

using ll=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  set<int> memo;
  int cnt = 0;
  rep(i,n){
    int a;
    cin >> a;
    a /= 400;
    if(a <= 7) memo.insert(a);
    if(a >= 8) cnt++;
  }
  int Min = memo.size();
  if(memo.size() ==0) Min = 1;
  int Max = memo.size() + cnt;
  cout << Min << ' ' << Max;
   
}

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



int main() {
  int n, m; cin >> n >> m;
  long long ans=0;
  vector<int> a(n), b(m), c(m);
  rep(i, n) {
    cin >> a[i];
  }
  rep(i, m) {
    cin >> b[i] >> c[i];
  }
  
  priority_queue<pair<int, int>> q;
  rep(i, n){
    q.push(make_pair(a[i], 1));
  }
  rep(i, m){
    q.push(make_pair(c[i], b[i]));
  }
  rep(i, n){
    auto p = q.top();
    q.pop();
    ans += p.first;
    if(p.second > 1) {
      p.second--;
      q.push(p);
    }
  }
  cout << ans << endl;
}

    

Measured memory_bytes: 3572
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:usize = read();
    let a:u32 = read();
    let b:u32 = read();

    let p:Vec<u32> = (0..n).map(|_| read()).collect();

    let mut cnt = vec![0,0,0];

    for &el in p.iter() {
        if el <= a {cnt[0]+=1}
        if a < el && el <=b {cnt[1]+=1}
        if b < el {cnt[2]+=1}
    }

    println!("{}", min(cnt[0],min(cnt[1],cnt[2])));


}


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

const ll INF = pow(10, 9) + 7;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i,N) cin >> a[i];
  bool aa =true;
  rep(i,N){
    if(a[i]%2 ==0){
      if(a[i]%3 != 0 && a[i]%5 != 0) aa= false;
    }
  }
    if(aa) cout <<"APPROVED";
    else cout << "DENIED";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
int a,b;
string s; 
int main(){
	cin>>a>>b;
	cin>>s;
	for(int i=0;i<a+b;i++){
		if(i!=a&&(s[i]<'0'||s[i]>'9')){
			cout<<"No";
			return 0;
		}
		else if(i==a&&s[i]!='-'){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}
/*

*/


Measured memory_bytes: 256
let a, b, k = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let i, c = ref @@ min a b, ref 0
let _ = while !c < k do if a mod !i = 0 && b mod !i = 0 then incr c; decr i done; Printf.printf "%d\n" @@ !i + 1

Measured memory_bytes: 384
using System;

namespace ConsoleApp2
{
	class Program
	{
		static void Main(string[] args)
		{
			var a = Console.ReadLine().Split(' ');
			int n = int.Parse(a[0]);
			int d = int.Parse(a[1]);

			// 2d + 1 の範囲をカバー
			int count = n / (2 * d + 1);
			if (n % (2 * d + 1) != 0)
			{
				count++;
			}

			Console.WriteLine(count);
		}
	}
}


Measured memory_bytes: 11092
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    string s;
    cin >> s;
    int n = s.size();
    cout << s[0] << n - 2 << s[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

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; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

// 成績を t にするために必要な修行の回数の最低値
ll calc(vector<ll>& a, vector<ll>& f, ll t) {
  ll k = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] * f[i] <= t) continue;
    k += a[i]  - t / f[i];
  }
  return k;
}

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n), f(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> f[i];

  sort(a.rbegin(), a.rend());
  sort(f.begin(), f.end());

  ll lb = -1;
  ll ub = 0;
  rep(i, n) chmax(ub, a[i] * f[i]);

  while (ub - lb > 1) {
    ll mid = lb + (ub - lb) / 2;
    if (calc(a, f, mid) > k) lb = mid;
    else ub = mid;
  }

  cout << ub << endl;

  return 0;
}


Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
int n,m,a[3001];
char s[3001][3001];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)scanf("%s",s[i]);
	int ans=max(n,m);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m-1;j++)
			if(i&&!(s[i-1][j]^s[i-1][j+1]^s[i][j]^s[i][j+1]))a[j]++;
			else a[j]=1;
		stack<int> q;
		q.push(-1);
		for(int j=0;j<m;j++)
		{
			while(q.size()>1&&a[q.top()]>=a[j])
			{
				int x=q.top();q.pop();
				ans=max(ans,a[x]*(j-q.top()));
			}
			q.push(j);
		}
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 6400
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


H,A=input2()
num=H//A
if H%A>0:
	num+=1
print(num)


Measured memory_bytes: 3060
#include<stdio.h>
int n,a,i,p[200000]={},m[200000]={};
long r=0;
int main(){
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        if(i+a<200000)p[i+a]++;
        if(i-a>=0)m[i-a]++;
    }
    for(i=0;i<200000;i++){
        r+=(long)p[i]*m[i];
    }
    printf("%ld",r);
    return 0;
}

Measured memory_bytes: 3288
package main

import "fmt"

func main() {
	var k, n int
	fmt.Scanf("%d %d", &k, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	min := k
	var right, left int
	for i := 0; i < n; i++ {
		if i > 0 {
			right = k + (a[i-1] - a[i])
		} else {
			right = a[n-1] - a[0]
		}
		if i < n-1 {
			left = k - (a[i+1] - a[i])
		} else {
			left = a[n-1] - a[0]
		}
		if left >= right && right < min {
			min = right
		} else if left < right && left < min {
			min = left
		}
	}
	fmt.Println(min)
}


Measured memory_bytes: 6956
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,x;
  cin >> a >> b >> x;
  if (2*x <= a*a*b)cout << 180*atan(double(a*b*b)/(2*x))/M_PI << endl;
  else cout << std::setprecision(10) << 180*atan(double(2*(a*a*b-x))/(a*a*a))/M_PI << endl;
}


Measured memory_bytes: 256
from sys import stdin

order = { "S" : 0, "H" : 1, "C" : 2, "D" : 3 }
cards = [
    [False] * 13, # S
    [False] * 13, # H
    [False] * 13, # C
    [False] * 13  # D
]

stdin.readline().rstrip()
while True:
    try:
        suit, num = stdin.readline().rstrip().split()
        cards[order[suit]][int(num)-1] = True
    except:
        break

order = {v:k for k, v in order.items()}
for i in range(4):
    for j in range(13):
        if cards[i][j] != True:
            print(order[i], j+1)


Measured memory_bytes: 5604
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<cstring>
#include<unordered_map>
#include<set>
#include<string.h>
#define int long long
using namespace std;

int a, b;
int c[12], d[12];
int dp[13][1 << 12];//i???????????§??????j?????£??????????????§???
void saiki(int e, int f) {
	dp[e + 1][f] = dp[e][f];
	for (int i = 0; i < b; i++) {
		if (f&(1ll << i)) {
			dp[e + 1][f - (1ll << i)] = max(dp[e+1][f-(1ll<<i)], dp[e][f] + abs(c[e] - d[i])*(abs(c[e] - d[i]) - 30)*(abs(c[e] - d[i]) - 30));
		}
	}
}
signed main() {
	while (cin >> a >> b, a | b) {
		memset(dp, 0, sizeof(dp));
		for (int e = 0; e < a; e++)cin >> c[e];
		for (int e = 0; e < b; e++)cin >> d[e];
		for (int e = 0; e < a; e++) {
			for (int f = 0; f < (1ll << b); f++) {
				saiki(e, f);
			}
		}
		cout << *max_element(dp[a], dp[a] + (1 << 12)) << endl;
	}
}

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

int main(){
  int N;
  cin >> N;
  string s, t;
  cin >> s >> t;
  
  string ans;
  
  for (int i = 0; i < N; i++) {
    ans = ans + s.at(i) + t.at(i);
  }
  
  cout << ans;
  
  return 0;
}


Measured memory_bytes: 256
use std::io;

fn main(){
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let mut iter = line.split_whitespace().map(|s| s.parse::<i32>().unwrap());
    let (a,b )= (iter.next().unwrap(),iter.next().unwrap());
    println!("{} {}",a*b,(a+b)*2);

}



Measured memory_bytes: 5036
aryA = []
aryB = []

5.times do
  x = gets.to_i
  if x % 10 == 0
    aryA << x
  else
    aryB << x
  end
end

aryB = aryB.sort_by{|a| a % 10}.reverse

if aryA.size > 0
  ans = aryA.inject(:+)
else
  ans = 0
end

if aryB.size > 0
  (aryB.size - 1).times do |i|
    if aryB[i] > 9
      ans += ((aryB[i] / 10.0).ceil) * 10
    else
      ans += 10
    end
  end
  ans += aryB[-1]
end

puts ans


Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
 
long long dec(string s)
{
  long long h=1,d=0;
  for(int i=s.length()-1;i>=0;i--){
    if(s[i]=='a')d+=10*h;
    else if(s[i]=='b')d+=11*h;
    else if(s[i]=='c')d+=12*h;
    else if(s[i]=='d')d+=13*h;
    else if(s[i]=='e')d+=14*h;
    else if(s[i]=='f')d+=15*h;
    else d+=(s[i]-'0')*h;
    h*=16;
  }
  return d;
}
 
string hex(long long dec)
{
  string h="";
  for(int i=0;i<8;i++){
    int b=dec%16;
    dec=dec/16;
    if(b==10)h+='a';
    else if(b==11)h+='b';
    else if(b==12)h+='c';
    else if(b==13)h+='d';
    else if(b==14)h+='e';
    else if(b==15)h+='f';
    else h+=('0'+b);
    if(dec==0)break;
  }
  reverse(h.begin(),h.end());
  return h; 
}
 
int main()
{
  long long N[9],k,sum,d;
  string a;
  int S,x,y;
 
  cin>>S;
  
  for(int n=0;n<S;n++){
    for(int i=0;i<9;i++){
      cin>>a;
      N[i]=dec(a);
    }
    k=0;d=1;
    for(int i=0;i<32;i++){
      sum=0;
      for(int j=0;j<8;j++){
    sum+=N[j];
    sum%=4294967296;
      }
      x=(sum/d)%2;
      y=(N[8]/d)%2;
      if(x!=y){
        k+=d;
    for(int j=0;j<8;j++)N[j]=N[j]^d;
      }
      d*=2;
    }
    cout<<hex(k)<<endl;
 
  }
  return 0;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using ll=long long;
ll a[100010];
int main(){_;
  int n;cin>>n;
  REP(i,n)cin>>a[i];

  ll resulti=0;
  for(int i=0;i<n;i++){
    if(i%2==0)resulti+=a[i];
    else resulti-=a[i];
  }
  cout<<resulti;
  REP(i,n-1){
    resulti=a[i]*2-resulti;
    cout<<" "<<resulti;
  }
  cout<<endl;
}


Measured memory_bytes: 2176
#include <iostream>
using namespace std;
int b=100000;
int a;

int main(){
	cin>>a;
	for(int i=0;i<a;i++){
		b*=1.05;
		int d=b/1000;
    if(d*1000<b){
		b=d*1000+1000;
		}    

	}

	cout<<b<<endl;
	return 0;
	}

Measured memory_bytes: 2980
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var s = o.a(1).split("");
  s[k-1] = String.fromCharCode(s[k-1].charCodeAt()+32)
  return s.join("");
}

Measured memory_bytes: 22076
/*
ID: wangjun30
TASK:
LANG: C++
*/
#include<iostream>
#include<cmath>
using namespace std;
const double precision=1e-7;
int main(){
	int n,d,ans=0;
	cin>>n>>d;
	int g[n][d];
	for(int i=0;i<n;i++)
		for(int j=0;j<d;j++)
			cin>>g[i][j];
	for(int i=0;i<n-1;i++)
		for(int j=i+1;j<n;j++){
			int val=0;
			for(int k=0;k<d;k++)
				val+=abs(g[i][k]-g[j][k])*abs(g[i][k]-g[j][k]);
			if(fabs(double(sqrt(val))-double(int(sqrt(val))))<=precision)
				ans++;
		}
	cout<<ans;
	return 0;
}

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


int main() {
	char s[19];
	for (int i = 0; i < 19; i++) {
		cin >> s[i];
	}
	cout << s[0] << s[1] << s[2] << s[3] << s[4] << " " << s[6] << s[7] << s[8] << s[9] << s[10] << s[11] << s[12] << " " << s[14] << s[15] << s[16] << s[17] << s[18] << endl;
	return 0;
}


Measured memory_bytes: 256
L,R = map(int,input().split())

ans = 10 ** 10
for i in range(L, min(L + 2019, R + 1)):
  for j in range(i + 1, min(L + 2019, R + 1)):
    if ans > (i * j) % 2019:
      ans = (i * j) % 2019

print(ans)

Measured memory_bytes: 9124
n, x, y = (map(int, input().split()))
ptns = [0 for _ in range(n-1)]

for i in range(1, n):
    for j in range(i+1, n+1):
        tmp = min(abs(j-i), abs(x - i) + 1 + abs(y - j))
        ptns[tmp - 1] += 1

for j in ptns:
    print(j)

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

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

long long int dp[3][100000];
vector< tuple<int, int, int> > v(100000);
int n;
long long int chooseA(int i);
long long int chooseC(int i);

long long int chooseB(int i) {
	//cout << "B -> " << get<1>(v[i]) << endl;
	if(dp[1][i]) return dp[1][i];
	if(i == n-1) return dp[1][i] = get<1>(v[i]);
	return dp[1][i] = max(chooseA(i+1), chooseC(i+1)) + get<1>(v[i]);
}

long long int chooseA(int i) {
	//cout << "A -> " << get<0>(v[i]) << endl;
	if(dp[0][i]) return dp[0][i];
	if(i == n-1) return dp[0][i] = get<0>(v[i]);
	return dp[0][i] = max(chooseB(i+1), chooseC(i+1)) + get<0>(v[i]);
}

long long int chooseC(int i) {
	//cout << "C -> " << get<2>(v[i]) << endl;
	if(dp[2][i]) return dp[2][i];
	if(i == n-1) return dp[2][i] = get<2>(v[i]);
	return dp[2][i] = max(chooseA(i+1), chooseB(i+1)) + get<2>(v[i]);
}

int main()
{
	fastio;
	cin >> n;
	for(int i = 0; i < n; i++) {
			int a, b, c;
			cin >> a >> b >> c;
			v[i] = {a, b, c};
	}	
	cout << max({chooseA(0), chooseB(0), chooseC(0)}) << endl;
//	exit(0);
//	
//	dp[0][0] = get<0>(v[0]);
//	dp[1][0] = get<1>(v[0]);
//	dp[2][0] = get<2>(v[0]);
//	
//	for(int i = 1; i < n; i++) {
//		dp[0][i] = max(dp[1][i-1], dp[2][i-1]) + get<0>(v[i]);
//		dp[1][i] = max(dp[0][i-1], dp[2][i-1]) + get<1>(v[i]);
//		dp[2][i] = max(dp[0][i-1], dp[1][i-1]) + get<2>(v[i]);
//		//cout << dp[0][i] << " " << dp[1][i] << " " << dp[2][i] << endl;
//	}
//	
//	cout << max({dp[0][n-1], dp[1][n-1], dp[2][n-1]}) << endl;
	return 0;
}

Measured memory_bytes: 11408
import sys
A,B = map(int, input().split())

count = 0
for a in range(1,13,1):
    if a>A:
        break
    for b in range(1,32,1):
        if a==A and b > B:
            print(count)
            sys.exit()
        if a==b:
            count = count + 1

print(count)

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

int main(){
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    int train, bus;
    if(a<b){
        train = a;
    }
    else{
        train = b;
    }

    if(c<d){
        bus = c;
    }
    else{
        bus = d;
    }


    cout<<train+bus<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int n,c,k,head=1,ci=1;
long long tim[111111],ans[111111];
bool cmp(long long a,long long b){
	return a<b;
}
int main(){
	cin>>n>>c>>k;
	bool flag=false;
	for(int i=1;i<=n;i++)scanf("%lld",&tim[i]);
	if(c==1){
		cout<<n;
		return 0;
	}
	sort(tim+1,tim+1+n,cmp);
	for(int i=1;i<=n;i++){
		if(i!=1&&ci!=c){
			if(tim[i]<=ans[head-1]&&tim[i]+k>=ans[head-1])ci++;
			else flag=true;
		}
		else if(ci==c||i==1){
			ans[head++]=tim[i]+k;
			flag=false;
			if(ci==c)ci=1;
		}
		if(flag){
			ans[head++]=tim[i]+k;
			flag=false;
			ci=1;
		}
	}
	cout<<head-1;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner( System.in );
		
		int N = sc.nextInt();
		Integer[] A = new Integer[N];
		
		for ( int i = 0; i < N; i++ ) {
			A[i] = sc.nextInt(); 
		}
		
		Arrays.sort(A, Comparator.reverseOrder());
		
		int Alice = 0;
		int Bob = 0;
		
		for ( int i = 0; i < N; i += 2 ) {
			Alice += A[i];
		}
		
		for ( int i = 1; i < N; i += 2) {
			Bob += A[i];
		}
		System.out.println(Alice - Bob);
		
		sc.close();

	}

}

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

int main()
{
    int a, b;
    cin >> a >> b;
    vector<int> t(999);
    int sum = 0;
    for (int i = 1; i <= 999; i++)
    {
        sum += i;
        t[i] = sum;
        // cout << t[i] << endl;
    }
    int ans = 0;
    for (int i = 1; i < 999; i++)
    {
        if (t[i + 1] - t[i] == b - a)
        {
            ans = t[i] - a;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		// #ifndef ONLINE_JUDGE
  //   // for getting input from input.txt
	 //    freopen("input.txt", "r", stdin);
	 //    // for writing output to output.txt
	 //    freopen("output.txt", "w", stdout);
		// #endif
		// cin>>T;
		// // cin.ignore(); must be there when using getline(cin, s)
		// while(T--)
		// {
			
		// }
		// return 0;
		int a, b, c;
		cin >> a>> b >> c;
		int t;
		t=a;
		a=b;
		b=t;
		t=c;
		c = a;
		a=t;
		cout << a  << " " << b << " " << c << endl;
	}


Measured memory_bytes: 256
n = input()
a = []
for _ in range(n):
    a.append(map(int, raw_input().split()))

dp_sum = [0] * (1 << n)
for mask in range(3, 1 << n):
    for j in range(n):
        if mask & (1 << j):
            dp_sum[mask] = dp_sum[mask ^ (1 << j)]
            for k in range(j + 1, n):
                if mask & (1 << k):
                    dp_sum[mask] += a[j][k]
            break

dp = [0] * (1 << n)
for mask in range(3, 1 << n):
    dp[mask] = dp_sum[mask]
    sub = (mask - 1) & mask
    while sub:
        dp[mask] = max(dp[mask], dp[mask ^ sub] + dp_sum[sub])
        sub = (sub - 1) & mask
print(dp[(1 << n) - 1])


Measured memory_bytes: 34280
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main(void)
{
    int *a , n ,i,c;

    scanf("%d" , &n);

    a = (int *)malloc( sizeof(int)*n);

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

    c=0;
    for(i=0;i<n-1;i++){
        if(a[i+1]==a[i]){
            c++; 
            i++;
            //if(a[i+1]==a[i]&& i<n-1)
                //i++;
        }
    }

    printf("%d\n" , c);

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
//--------------------------------------------------------------

void Main(){
  int n; cin>>n;
  int m; cin>>m;
  if(n==m){
    cout<<"Yes";
  }else{
    cout<<"No";
  }

} int main(int argc,char** argv)
{fastio; myio; Main();}


Measured memory_bytes: 256
N = int(input())
A = [int(x) for x in input().split()]

from collections import Counter
Aco = Counter(A)

ing = []
ing2 = []
for a in Aco.keys() :
    if Aco[a] >= 2 :
        ing.append(a)
    if Aco[a] >= 4 :
        ing2.append(a)

ing.sort(reverse = True)
ing2.sort(reverse = True)
if ing2 :
    if ing2[0] == ing[0] :
        print(ing2[0]**2)
        exit()

if len(ing) <= 1 :
    print(0)
else :
    print(ing[0] * ing[1])


Measured memory_bytes: 18216
#include <stdio.h>
#include <string.h>

int main(void){

  int i;
  char s[4],t[4];
  int ans=0;

  scanf("%s %s", s, t);

  for(i=0; i<3; i++){
    if(s[i]==t[i]){
      ans++;
    }
  }

  printf("%d\n", ans);

  return 0;
}


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

int N,S,sum=0,ans=1e9,k;
int a[100000];
int main(){

  scanf("%d %d",&N,&S);
  for(int i=0;i<N;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
    while(sum-a[k]>=S){
      sum-=a[k];
      k++;
    }
    if(sum>=S)ans=min(ans,i-k+1);
  }
  if(ans==1e9)ans=0;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 3592
def main():
    import sys

    input = sys.stdin.readline

    x, y, z, k = map(int, input().split())
    A = sorted(map(int, input().split()), reverse=True)
    B = sorted(map(int, input().split()), reverse=True)
    C = sorted(map(int, input().split()), reverse=True)

    ret = []
    for p, a in enumerate(A, 1):
        for q, b in enumerate(B, 1):
            if p * q > k:
                break
            for r, c in enumerate(C, 1):
                if p * q * r > k:
                    break
                ret.append(a + b + c)
    ret.sort(reverse=True)
    print(*ret[:k], sep='\n')


main()

# O(Klog^3K)
# https://img.atcoder.jp/abc123/editorial.pdf
# Enumerateのindex間違えていた


Measured memory_bytes: 46192
# プリム法
# 愚直にやるとO(N**2)
import heapq
N = int(input())
townX = []
townY = []
for i in range(N):
    x,y = map(int,input().split())
    townX.append((x-1, i))
    townY.append((y-1, i))
townX.sort()
townY.sort()
edge = [[] for i in range(N)]
for i in range(N-1):
    x, nowTown = townX[i]
    xx, nextTown = townX[i+1]
    edge[nowTown].append((xx-x, nextTown))
    edge[nextTown].append((xx-x, nowTown))
for i in range(N-1):
    y, nowTown = townY[i]
    yy, nextTown = townY[i+1]
    edge[nowTown].append((yy-y, nextTown))
    edge[nextTown].append((yy-y, nowTown))
q = []
used = [0]*N
used[0] = 1
ans = 0
# 頂点どれでもいいので根を0とする
# 全ての街に対して道があると考える
for i in edge[0]:
    heapq.heappush(q, i)
while len(q)>0:
    price, nowTown = heapq.heappop(q)
    if used[nowTown] == 0:
        used[nowTown] = 1
        ans += price
        for p,j in edge[nowTown]:
            if used[j] == 0:
                heapq.heappush(q, (p, j))
print(ans)


Measured memory_bytes: 123992
import heapq
n,m=map(int,input().split())
ab=[[0]*2 for _ in range(n)]


for i in range(n):
    ab[i]=list(map(int,input().split()))
ab.sort()
hq=[]
tmp=0
ans=0
for i in range(1,m+1):
    while tmp<n and ab[tmp][0]<=i:
        heapq.heappush(hq,-ab[tmp][1])
        tmp+=1
    if hq:
        ans-=heapq.heappop(hq)
print(ans)


Measured memory_bytes: 78444
#include "bits/stdc++.h"
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    int c = 0;
    cin>>a>>b;
    if(b<=1){
        cout<<0<<endl;
        return 0;
    }
    int d = 0;
    bool flag = false;
    while(1){
        if(d>=b){
            break;
        }
        c++;
        if(d==0){
            d+=(a);
        }else{
            d+=(a-1);
        }
    }
    cout<<c<<endl;
    return 0;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const long long inf2=0x3f3f3f3f3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int n;
vector<int>g[100005];
int dp[100005][2];
//0->black 1->white
void dfs(int x,int par){
	for(auto to:g[x])if(to!=par)dfs(to,x);
	dp[x][0]=dp[x][1]=1;
	for(auto to:g[x])if(to!=par){dp[x][0]=(ll)dp[x][0]*dp[to][1]%mod;dp[x][1]=(ll)dp[x][1]*(dp[to][0]+dp[to][1])%mod;}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(1,-1);
	printf("%d\n",(dp[1][0]+dp[1][1])%mod);
	return 0;
}

Measured memory_bytes: 13440
from itertools import accumulate

def main():
  n = int(input())
  alst = list(map(int, input().split()))
  acc = [0] + list(accumulate(alst))

  INF = 10 ** 10
  dp = [[None] * n for _ in range(n)]
  for i in range(n):dp[i][i] = 0
    
  for length in range(2, n + 1):
    for left in range(n - length + 1):
      right = left + length - 1
      min_score = INF
      to_right = acc[right + 1]
      to_left = acc[left]
      for k in range(left, right):
        left_sum = acc[k + 1] - to_left
        right_sum = to_right - acc[k + 1]
        score = dp[left][k] + dp[k + 1][right]
        c = 0
        while left_sum or right_sum or c:
          x = left_sum % 10
          y = right_sum % 10
          score += x * y + c
          if min_score <= score:break
          c = 0 if  x + y + c < 10 else 1
          left_sum //= 10
          right_sum //= 10
        else:
          min_score = score
      dp[left][right] = min_score
  print(dp[0][n - 1])

main()


Measured memory_bytes: 7616