akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;


// ?????????????????????????????????????????????????????????
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = 2;
		boolean same = true; 
		Dice[] dice = new Dice[n];
		int[] temarray = new int[6 + 1];
		int[] tararray = new int[6 + 1];
		temarray[0] = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 1; j < 7; j++) {
				temarray[j] = scan.nextInt();
			}
			dice[i] = new Dice(temarray);
		}
		temarray = dice[0].getNum();
		if (dice[1].check(temarray)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}
	

class Dice {
	private int[] num = new int[6 + 1];
	Dice() {
	}

	Dice(int[] array) {
		for (int i = 0; i < array.length; i++) {
			this.num[i] = array[i];
		}
	}
	
	public int[] getNum() {
		return this.num;
	}
	
	public int getNumber(int i) {
		return this.num[i];
	}
	
	// ??????????????¢??????????????????
	public int[] roll(int[]ary, String order) {
		int now_1 = 1;	int now_2 = 2;	int now_3 = 3;	int tmp;
		int[] array = ary;
		char[] check = {'N', 'E', 'S', 'W'};
		for (int i = 0; i < order.length(); i++) {
			for (int j = 0; j < check.length; j++) {
				if (order.charAt(i) == check[j]) {
					switch (j + 1) {
						case 1:
							tmp = now_1;
							now_1 = now_2;
							now_2 = 7 - tmp;
							break;
						case 2:
							tmp = now_1;
							now_1 = 7 - now_3;
							now_3 = tmp;
							break;
						case 3:
							tmp = now_1;
							now_1 = 7 - now_2;
							now_2 = tmp;
							break;
						case 4:
							tmp = now_1;
							now_1 = now_3;
							now_3 = 7 - tmp;
							break;
					}
				}
			}
		}
		int[] cp_array = new int[array.length];
		cp_array[1] = array[now_1]; cp_array[2] = array[now_2];
		cp_array[3] = array[now_3]; cp_array[4] = array[7 - now_3];
		cp_array[5] = array[7 - now_2]; cp_array[6] = array[7 -now_1];
		return cp_array;
	}
	
	
	// ??????????????????????????????????????????
	public boolean check(int[] tarary) {
		int[] ary = tarary;
		String[] str = {"null", "N", "N", "N", "E", "WW"};
		int sum = 0;
		int[] array = new int[this.num.length];
		for (int i = 0; i < this.num.length; i++) {
			array[i] = this.num[i];
		}
		boolean decision = false;
		for (int i = 0; i < str.length; i++) {
			array = this.roll(array, str[i]);
			for (int j = 0; j < 4; j++) {
				if (array[1] == ary[1]) {
					if (array[2] == ary[2]) {
						for (int k = 3; k < ary.length; k++) {
							
							if (array[k] != ary[k]) {
								decision = false;
								break;
							}
							decision = true;
						}
					}
					if (decision) {
						break;
					} else {
						array = this.roll(array, "NWS");
					}
				} else {
					break;
				}
			}
			if (decision) break;
		}
		

		return decision;
	}
}

Measured memory_bytes: 26400
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline bool read(ll &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
int main(){
int a[3]={read(),read(),read()};
sort(a,a+3);
if (a[0]+a[1]==a[2]) puts("Yes");
else puts("No");
}

Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:53 on 2020-04-26.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s;
    cin >> s;
    ll now = 0;
    map<ll, ll> mp;
    mp[0] = 1;
    reverse(all(s));
    ll ten = 1;
    rep(i, s.size()) {
        now = (now + (s[i] - '0') * ten) % 2019;
        ten *= 10;
        ten %= 2019;
        mp[now]++;
    }
    ll ans = 0;
    each(e, mp) {
        ans += e.S * (e.S - 1) / 2;
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3744
#include<stdio.h>
int a,b,c,d;
int main(){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a+b>c+d){
        printf("Left\n");
    }
    else if(a+b==c+d){
        printf("Balanced\n");
    }
    else{
        printf("Right\n");
    }
}


Measured memory_bytes: 128
import Data.List
main=do
 [n,x]<-map read.words<$>getLine
 a<-sort.map read.words<$>getLine
 print(f x a)
  where f x [a] = if x==a then 1 else 0
        f x (c:a) = if x>=c then (1+(f (x-c) a)) else (f 0 a)

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

using namespace std;


int main() {
    int n;
    cin >> n;
    set<int> s;
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if(s.count(a)) {
            s.erase(a);
        } else {
            s.insert(a);
        }
    }
    cout << s.size() << "\n";
    return 0;
}

Measured memory_bytes: 8260
#include "bits/stdc++.h"
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
#define PI 3.1415926535
using namespace std;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int a, b;

	cin>>a>>b;

	if((a*b)%2){
		cout<<"Odd"<<endl;
	}else{
		cout<<"Even"<<endl;
	}

}

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int sum=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='R') sum++;
        else if(s[i]=='S' && s[i+1]=='R') sum=0;
    }
    cout<<sum<<endl;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int a, b, c, d;
    a = n/1000; b = n/100%10; c = n/10%10; d = n%10;
    char cal[4];
    int num[4] = {a, b, c, d};
    for(int bit = 0; bit < (1<<3); ++bit){
        int ans = a;
        rep(i,3){
            if(bit & (1<<i)){
                ans+= num[i+1];
                cal[i] = '+';
            }
            else{
                ans-=num[i+1];
                cal[i]='-';
            }
        }
        if(ans==7){
            printf("%d%c%d%c%d%c%d=7", num[0], cal[0], num[1], cal[1], num[2], cal[2], num[3]);
            return 0;
        }
        
    }
    return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	string s;
	cin >> s;
	vi v(n+1);
	REP(i, n) {
		if (s[i] == 'E')v[i + 1] = 0;
		else v[i + 1] = 1;
	}
	REP(i, n)v[i + 1] += v[i];
	int ans = INF;
	REP(i, n) {
		ans = min(ans, v[i]  +(n - 1 - i- (v[n] - v[i+1])));
	}
	cout << ans << endl;
}


Measured memory_bytes: 1812
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define INF ((1LL<<62)-(1LL<<31))

//遅い方のダイクストラ（早い方の完全下位互換だが一応）
//頂点数、スタート（と隣接行列）を引いて最短距離と経路を返す
//O(V^2)
ll daikusutorap[1<<11];
ll cost[1<<10][1<<10];//辺が無いところはINFにする前処理が必要
void daikusutora(ll n,ll s){
	ll*f=(ll*)malloc(n*sizeof(ll));
	rep(i,0,n){
		daikusutorap[i]=i==s?0:INF;
		f[i]=0;
	}
	rep(nnnnnn,1,n){
		ll m=INF,mv=-1;
		rep(i,0,n){
			if(!f[i]&&m>daikusutorap[i]){
				m=daikusutorap[i];
				mv=i;
			}
		}
		if(mv==-1)break;
		f[mv]=1;
		rep(i,0,n)if(cost[mv][i]&&daikusutorap[i]>daikusutorap[mv]+cost[mv][i]){
			daikusutorap[i]=daikusutorap[mv]+cost[mv][i];
			daikusutorap[n+i]=mv;
		}
	}
	free(f);
}

char s[60][60];
int d4[]={0,1,0,-1,0};
int main(){
	rep(i,0,26)rep(j,0,26)cost[i][j]=INF;
	int h,w;
	char x,y;
	scanf("%d%d %c %c",&h,&w,&x,&y);
	rep(i,0,h)scanf(" %s",s[i]);
	for(int i=0;i<h;i++)for(int j=0;j<w;j++)if('A'<=s[i][j]&&s[i][j]<='Z'){
		int start=s[i][j]-'A';
		for(int k=0;k<4;k++){
			int ci=i+d4[k]*2,cj=j+d4[k+1]*2;
			char edge=d4[k]?'|':'-';
			if(0<=ci&&ci<h&&0<=cj&&cj<w&&s[ci][cj]==edge){
				while(s[ci][cj]==edge){
					ci+=d4[k];
					cj+=d4[k+1];
				}
				ci+=d4[k];
				cj+=d4[k+1];
				int goal=s[ci][cj]-'A';
				cost[start][goal]=1;
			}
		}
	}
	daikusutora(26,x-'A');
	printf("%lld\n",daikusutorap[y-'A']);
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int a,b;
    while(cin>>a>>b){
        if((a==1||a==3||a==5||a==7||a==8||a==10||a==12 )&&(b==1||b==3||b==5||b==7||b==8||b==10||b==12 ))
            cout<<"Yes"<<endl;
        else if((a==4||a==6||a==9||a==11)&&(b==4||b==6||b==9||b==11))
            cout<<"Yes"<<endl;
        else if(a==2&&b==2)
            cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


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

using namespace std;

int H, W;

int main() {
  int N, M;
  vector<int> road_count;

  cin >> N >> M;
  road_count.resize(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    road_count[a]++;
    road_count[b]++;
  }

  for (int i = 0; i < N; i++) {
    cout << road_count[i] << endl;
  }

  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

bool isprime(int x){
	if(x<=1) return false;
	if(x==2) return true;
	if(x%2==0) return false;
	for(int i = 3; i*i <= x; i += 2){
		if(x%i==0) return false;
	}
	return true;
}

void Main(){
	int n = 1001001;
  
	vector<bool> prime(n, false);
	rep(i,n){
    	if(isprime(i)) prime[i] = true;
    }
  
	vi isok;
	rep(i,n){
		if(prime[i] && prime[(i+1)/2]) isok.pb(i);  
	}

	/*
	rep(i,100){
    	if(prime[i]) cout << i << endl;  
	}
	//*/

	int q;
	cin >> q;
	int l, r;
	rep(i,q){
		cin >> l >> r;
		// l 以上 r 以下の奇数で isok に入っている数がいくつあるか？
		// lower_bound : key 以上のイテレータを返す
		// upper_bound : key より大きいイテレータを返す
		int ans = upper_bound(all(isok), r) - lower_bound(all(isok), l);
		cout << ans << endl;
	}
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 768
from collections import defaultdict
def solve(n,A):
    S=set(A)
    l=len(S)
    if S=={0}:
        return 'Yes'
    if n%3 or l==1 or l>3:
        return 'No'
    d=defaultdict(int)
    for a in A:
        d[a]+=1
    if l==2:
        return 'Yes' if d[0]==n//3 else 'No'
    x=0
    for s in S:
        if d[s]!=n//3:
            return 'No'
        x^=s
    return 'No' if x else 'Yes'

n=int(input())
A=tuple(map(int,input().split()))
print(solve(n,A))

Measured memory_bytes: 15356
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[3001],t[3001];
    scanf("%s %s",s,t);
    int t1=strlen(s),t2=strlen(t);
    string ans[2][t2+1];
    for(int i=1;i<=t1;i++)
    {
        for(int j=1;j<=t2;j++)
        {
            if(s[i-1]==t[j-1])
            {
                ans[i%2][j]=ans[(i-1)%2][j-1]+s[i-1];
            }else
            {
                if(ans[i%2][j-1].size()>ans[(i-1)%2][j].size())
                {
                    ans[i%2][j]=ans[i%2][j-1];
                }else
                {
                    ans[i%2][j]=ans[(i-1)%2][j];
                }
            }
        }
    }
    printf("%s",&ans[t1%2][t2][0]);
}


Measured memory_bytes: 19028
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

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

    int X,Y;cin >> X >> Y;
    for(int i = 0;i<=100;i++){
        for(int j = 0;j<=100;j++){
            if(i + j != X) continue;
            if(2*i+4*j != Y) continue;
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3652
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
        t: Chars,
    };
    let mut ans = true;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ans = false;
        }
    }
    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 2116
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, M, P[10009], C[509], E[509], dp[509][10009];
int main() {
	cin >> M >> N;
	for (int i = 0; i < M; i++) cin >> P[i + 1];
	for (int i = 0; i < N; i++) cin >> C[i] >> E[i];
	fill(dp[0] + 1, dp[0] + M + 1, 999999999);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= M; j++) {
			dp[i + 1][j] = dp[i][j];
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][max(j - C[i], 0)] + E[i]);
		}
	}
	sort(P + 1, P + M + 1, greater<int>());
	for (int i = 1; i <= M; i++) P[i] += P[i - 1];
	int ret = 0;
	for (int i = 0; i <= M; i++) ret = max(ret, P[i] - dp[N][i]);
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 22720
N = int(input())
Xlist = list(map(int,input().split()))
Xcopy = Xlist.copy()
Xcopy.sort()
Xsm = Xcopy[N//2-1]
Xla = Xcopy[N//2]
if Xsm == Xla:
    for _ in range(len(Xlist)):
        print(Xsm)
else:
    for i in range(len(Xlist)):
        Tar = Xlist[i]
        if Tar <= Xsm:
            print(Xla)
        else:
            print(Xsm)

Measured memory_bytes: 30900
#include <algorithm>
#include <iostream>

int main(void)
{
    int a[3];

    for (int i = 0; i < 3; i++) {
        std::cin >> a[i];
    }

    std::sort(a, a+3);

    for (int i = 0; i < 3; i++) {
        if (i > 0) {
            std::cout << " ";
        }
        std::cout << a[i];
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 3164
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;
#define ll signed long long 

string N;
ll K;
ll len;

ll combination(ll n, ll k) {
  if (n < k) {
    return 0;
  }
  ll ans = 1;
  for (int i = 0; i < k; ++i) {
    ans *= n - i;
  }
  for (int i = 0; i < k; ++i) {
    ans /= i + 1;
  }
  return ans;
}

ll all9 (ll n, ll k) {
  return (combination(n, k) * pow(9ll, k));
}

ll func (ll depth, ll k) {
  if (k == 0) {
    return 1;
  }
  if (depth == len) {
    return 0;
  }
  ll ret = 0;
  int num = N[depth] - '0';
  if (num > 1) {
    ret += all9(len - depth - 1, k - 1) * (num - 1);
  }
  if (num > 0) {
    ret += func(depth + 1, k - 1);
  }
  if (num > 0) {
    ret += all9(len - depth - 1, k);
  } else {
    ret += func(depth + 1, k);
  }
  return (ret);
}

int main (){
  cin >> N >> K;
  len = N.size();
  cout << func(0, K) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
 
using namespace std;
typedef long long ll;
 
#define ALL(obj) (obj).begin(), (obj).end() 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

 int main(){
    ll n,l,f=-1,s;
    cin >> n >> l;
    vector<ll> a(n); 
    rep(i,n) cin >> a[i];
    rep(i,n-1){
        if(a[i]+a[i+1] >= l){
            f = i; s = i+1;
            break;
        }
    }
    if(f==-1){cout << "Impossible" << endl;}
    else{
        cout << "Possible" << endl;
        rep(i,f) cout << i+1 << endl;
        FOR(i,s,n-1) cout << n + s - i - 1 << endl;
        cout << f+1 << endl;
    }

    return 0;
 }

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c;
	cin>>a>>b>>c;

	cout<<(a+b+c>21?"bust":"win") <<endl;

}


Measured memory_bytes: 764
import math
import itertools
import statistics
#import numpy as np
import collections

#n = int(input())
#h, w = list(map(int, input().split()))
s = input()
alf = ["a","b", "c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","i","s","t","u","v","w","x","y","z"]
have = []
for i in range(len(s)):
    for j in range(len(alf)):
        if s[i]==alf[j]:
            have.append(alf[j])

have = list(set(have))
for i in range(len(alf)):
    if not(alf[i] in have):
        print(alf[i])
        exit()
print("None")
            



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

using namespace std;

int main(){
	int a , br1=0 , br9=0 , br7=0 , br4=0;
	for (int i=0;i<4;i++){
		cin>>a;
		if (a==1) br1++;
		if (a==9) br9++;
		if (a==7) br7++;
		if (a==4) br4++;
	}
	if (!br1||!br9||!br7||!br4) cout<<"NO";
	else cout<<"YES";
	
	
}


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

int main () {
  int N, X;
  cin >> N >> X;
  vector<int> m(N);
  for (int i = 0; i < N; i++) {
    cin >> m.at(i);
  }
  for (int i = 0; i < N; i++) {
    X -= m.at(i);
  }
  sort(m.begin(), m.end());
  cout << N + X / m.at(0) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int d;
	scanf("%d", &d);
	int c[30];
	int i;
	for (i = 0; i < 26; i++)
		scanf("%d", &c[i]);
	int j;
	int s[400][30];
	for (i = 0; i < d; i++)
		for (j = 0; j < 26; j++)
			scanf("%d", &s[i][j]);
	int ans;
	for (i = 0; i < d; i++)
	{
      printf("%d\n",(1+2*i*i+3*i*i*i)%26+1);
	}
	return 0;
}


Measured memory_bytes: 1776
using System;
using System.Collections.Generic;
using static Assistant.Input;
using System.Linq;
using Assistant;

namespace エクサウィザーズ2019
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = ReadInt;
            var B = ReadInt;
            var C = ReadInt;

            if (A == B && B == C) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        //drawmap
        //drawarray
    }
}


Measured memory_bytes: 11220
def solve():
    import bisect
    N=int(input())
    lists=[int(input()) for _ in range(N)]
    inf = 10**15
    dp=[inf  for i in range(N+1)]
    for i in range(N):
        index=bisect.bisect_left(dp,lists[i])
        dp[index]=lists[i]
    for i in range(N+1):
        if dp[i]==inf:
            print(i)
            break
if __name__=="__main__":
    solve()


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

int main() {
  string s;
  cin >> s;
  int S=s.size();
  string ans="";
  for(int i=0;i<S;i++){
    if(s[i]=='0'){ans+='0';}
    else if(s[i]=='1'){ans+='1';}
    else{
      if(ans.size()!=0){ans=ans.substr(0,ans.size()-1);}
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
		using namespace std;
		#define ll int
		#define INF 100000000LL
		#define mod 1000000007
		#define pll pair<long,long>
		#define se second
		#define fi first
		#define pb push_back
		#include <ext/pb_ds/assoc_container.hpp>
		#include <ext/pb_ds/tree_policy.hpp>
		using namespace __gnu_pbds;

		typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
		typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update>pllordered_set;


		ll vis[100050][3];
		vector<ll> g1[100050];

		int main()
		{
					ios_base::sync_with_stdio(false);
					cin.tie(NULL);
					ll n,m;
					cin>>n>>m;
					ll dist[105][105];
					vector<tuple<ll,ll,ll> > edge;
					for(ll i=0;i<=n;i++)
					{
						for(ll j=0;j<=n;j++)
							dist[i][j]=INF;
					}
					for(ll i=0;i<=n;i++)
						dist[i][i]=0;
					for(ll i=0;i<m;i++)
					{
						ll u,v,w;
						cin>>u>>v>>w;
					//cout<<dist[u][v]<<" "<<dist[v][u]<<endl;
						dist[u][v]=min(dist[u][v],w);
						dist[v][u]=min(dist[v][u],w);
						edge.pb(make_tuple(u,v,w));
					}
					
					for(ll k=1;k<=n;k++)
					{
						for(ll i=1;i<=n;i++)
						{
							for(ll j=1;j<=n;j++)
							{
								if(dist[i][k]+dist[k][j]<dist[i][j])
								{
									dist[i][j]=dist[i][k]+dist[k][j];
								}
								
							}
						}
						
					}
					ll ans=0;
					for(auto i:edge)
					{
						ll u=get<0>(i);
						ll v=get<1>(i);
						ll w=get<2>(i);
						
						if(dist[u][v]<w)
						{
						//	cout<<u<<" "<<v<<" "<<dist[u][v]<<endl;
							ans++;
						}
					}
					
					cout<<ans;
					
					
		}


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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int sum=a+b+c;
	int maxv=max(a,max(c,b));
	cout<<sum-maxv<<endl;
}


Measured memory_bytes: 764
h,w = map(int,input().split())
A = [list(map(int,input().split())) for i in range(h)]
c = [1,1]
O = []
n = 0
for i in range(h*w-1):
  if A[c[0]-1][c[1]-1] % 2 == 0:
    if c[0]%2 != 0 and c[1] < w:
      c[1] += 1
    elif c[0]%2 == 0 and c[1] > 1:
      c[1] -= 1
    else:
      c[0] += 1
  else:
    if c[0]%2 != 0 and c[1] < w:
      O += [[c[0],c[1],c[0],c[1]+1]]
      c[1] += 1
    elif c[0]%2 == 0 and c[1] > 1:
      O += [[c[0],c[1],c[0],c[1]-1]]
      c[1] -= 1
    else:
      O += [[c[0],c[1],c[0]+1,c[1]]]
      c[0] += 1
    A[c[0]-1][c[1]-1] += 1
    n += 1
print(n)
for o in O:
  print(*o)

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

struct UnionFind{
  vector<int> p;
  UnionFind(int n){
    p.resize(n+1);
    for(int i=1; i<=n; i++)  p[i] = i;
  }
  int find(int x){
    if(x == p[x])  return x;
    return p[x] = find(p[x]);
  }
  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x != y)  p[x] = y;
  }
};

int main(){
  int n, m;  cin >> n >> m;
  vector<int> p(n+1, 0);
  for(int i=1; i<=n; i++)  cin >> p[i];
  UnionFind uf(n);
  while(m--){
    int x, y;  cin >> x >> y;
    uf.unite(x, y);
  }
  int ans = 0;
  for(int i=1; i<=n; i++)
    if(uf.find(i) == uf.find(p[i]))  ans++;
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3984
#include<stdio.h>
#define MAX_N 300
int m,n;
int arr[MAX_N];
int visited[MAX_N];
int visited2[MAX_N];
int flag[MAX_N];

void init();
void rec(int);
int solve(int);

int main(){
  int i,j,a,b;
  while(1){
    init();
    scanf("%d",&m);
    if(m==0)break;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
      scanf("%d",&a);
      b=i+a;
      if(b<0)b=0;
      if(b>n+1)b=n+1;
      arr[i]=b;
    }
    for(i=0;i<=n+1;i++){
      if(arr[i]==n+1)rec(i);
    }
    /*
    for(i=0;i<=n+1;i++){
      printf("%d ",visited[i]);
    }
    printf("\n");
    */
    flag[n+1]=1;
    if(solve(0))printf("NG\n");
    else printf("OK\n");
  }
  return 0;
}

int solve(int pos){
  if(visited2[pos])return 0;
  visited2[pos]=1;
  if(!flag[pos])return 1;
  int i,a;
  for(i=1;i<=m;i++){
    a=pos+i;
    if(a>n+1)break;
    a=arr[a];
    if( solve(a) )return 1;
  }
  return 0;
}

void rec(int pos){
  if(visited[pos])return;
  visited[pos]=1;
  int i,j,a;
  for(i=1;i<=m;i++){
    a=pos-i;
    if(a<0)break;
    flag[a]=1;
    for(j=0;j<=n+1;j++){
      if(arr[j]==a)rec(j);
    }
  }
}

void init(){
  int i,j;
  for(i=0;i<MAX_N;i++){
    arr[i]=i;
    visited[i]=0;
    visited2[i]=0;
    flag[i]=0;
  }
}

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

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 123;
int n;
ll a[N];
vector <ll> basis;

void add(ll x) {
	for (ll i : basis) {
		x = min(x, x ^ i);
	}
	if (x > 0) {
		basis.pb(x);
	}
}

int f(ll x) {
	for (int i = 59; i >= 0; i--) {
		if (x >> i & 1) {
			return i;
		}
	}
	return -1;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	ll t = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		t ^= a[i];
	}
	ll ans = t, rt = t ^ ((1ll << 60) - 1);
	for (int i = 1; i <= n; i++) {
		a[i] &= rt;
		add(a[i]);
	}
	sort(all(basis));
	reverse(all(basis));
	ll res = 0;
	for (ll i : basis) {
		if (res >> f(i) & 1) {
			continue;
		}
		res ^= i;
	}
	ans += 2 * res;
	cout << ans;
}


Measured memory_bytes: 1024
fun main(args: Array<String>) {

    val mod = 1e9.toLong() + 7

    class Comb {

        val n = 1e5.toInt()

        val fact = LongArray(n + 1)
        val factInv = LongArray(n + 1)

        init {
            fact[0] = 1L
            for (i in 1..n) {
                fact[i] = fact[i - 1] * i % mod
            }
            factInv[n] = inv(fact[n])
            for (i in n downTo 1) {
                factInv[i - 1] = factInv[i] * i % mod
            }
        }

        private fun pow(base: Long, exp: Long): Long {
            if (exp == 0L) return 1L
            var a = pow(base, exp shr 1)
            a *= a
            a %= mod
            if (exp and 1L == 0L) return a
            return base * a % mod
        }

        private fun inv(x: Long): Long {
            return pow(x, mod - 2)
        }

        fun comb(n: Int, k: Int): Long {
            if (k !in 0..n) return 0L
            return fact[n] * factInv[k] % mod * factInv[n - k] % mod
        }

    }

    val cb = Comb()

    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    var a = readLine()!!.split(' ').map { it.toLong() }.sorted()

    val ans = LongArray(2)

    repeat(2) {
        for (i in 0 until n) {
            if (i + 1 < k) continue
            if (a[i] >= 0) {
                val b = a[i] * cb.comb(i, k - 1) % mod
                ans[it] = ans[it] + b % mod
            } else {
                val b = -a[i] * cb.comb(i, k - 1) % mod
                ans[it] = (ans[it] + mod - b) % mod
            }
        }
        a = a.reversed()
    }

    println((ans[0] + mod - ans[1]) % mod)
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

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

	int N; cin >> N;
	vi a1 (N);
	F0R(i, N) cin >> a1[i];
	vi a2 (N);
	F0R(i, N) cin >> a2[i];

	int best = 0;
	F0R(i, N) {
		int total = 0;
		F0R(j, i+1) total += a1[j];
		FOR(j, i, N) total += a2[j];
		best = max(best, total);
	}
	print(best);
}

Measured memory_bytes: 256
d,n = map(int, input().split())

if d == 0:
    if n <= 99:
        print(n)
    else:
        print(101)
if d == 1:
    if n <= 99:
        print(n*100)
    else:
        print(10100)
if d == 2:
    if n <= 99:
        print(n*10000)
    else:
        print(1010000)    

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec A(N+1, 0);
    A[0] = 2; A[1] = 1;
    REP(i,2,N+1) A[i] = A[i-1] + A[i-2];
    PR(A[N]);

    return 0;
}

/*



*/

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,string> Team;
main(){
  int n;
  int cnt=0;
  int kati,make,hikiwake;
  while(1){
    cin>>n;
    if(n==0)break;
    if(cnt!=0){
      cout<<endl;
    }
    Team team[100];
    for(int i=0;i<n;i++){
      cin>>team[i].second>>kati>>make>>hikiwake;
      team[i].first.first=-(kati*3+hikiwake);
      team[i].first.second=i;
    }
    sort(team,team+n);
    for(int i=0;i<n;i++){
      cout<<team[i].second<<','<<-team[i].first.first<<endl;
    }
    cnt++;
  }
}
      
    

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int n, m;
    cin>>n>>m;
    pair<ll, ll> a[n];
    f(i, n){
        cin>>a[i].first>>a[i].second;
    }
    sort(a, a + n);
    ll ans = 0ll;
    f(i, n){
        if(m == 0) break;
        if(a[i].second > m){
            ans += a[i].first * m;
            m = 0;
        }
        else{
            m -= a[i].second;
            ans += a[i].first * a[i].second;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

diff = []
for i in H:
	diff.append(abs(A-T+i*0.006))

diffmin = diff[0]
ans = 0
for i in range(N):
	if diffmin > diff[i]:
		diffmin = diff[i]
		ans = i
print(ans+1)

Measured memory_bytes: 9132
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	int n,a,b,p,i;
	int x,y,z;
	x=y=z=0;
	cin >> n >> a >> b;
	for(i=0;i<n;i++){
		cin >> p;
		if(p>b)
			z++;
		else if(p>a)
			y++;
		else
			x++;
	}
	cout << min(min(x,y),z) << endl;
	return 0;
}


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

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define pb push_back
#define mp make_pair
#define sz(a) (ll)(a).size()
#define all(a) a.begin(), a.end()
#define ff first
#define ss second
#define endl "\n"

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
//K-th smallest
//cout << k << "rd smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;


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

ll mod=1000000007;

ll power(ll x, ll y) 
{
	ll temp;
	if( y == 0)
		return 1;
	temp = power(x, y/2);
	if (y%2 == 0)
		return (temp*temp)%mod;
	else
		return (((x*temp)%mod)*temp)%mod; 
}

vector<ll> dp(100005,LLONG_MAX);

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	vector<ll> h;
	ll i,j;
	for(i=0;i<n;i++)
	{
		ll val;
		cin>>val;
		h.pb(val);
	}
	dp[0]=0;
	for(i=0;i<n;i++)
		for(j=1;j<=k && i+j<n;j++)
			dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
	cout<<dp[n-1]<<endl;
	return 0;
}

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

int main(){
  	int x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> x1 >> y1 >> x2 >> y2;
	int x = y2 - y1;
	int y = x2 - x1;
	x3 = x2 - x ;
	y3 = y2 + y;
	x4 = x1 - x;
	y4 = y1 + y;
	cout << x3 << endl;
  	cout << y3 << endl;
  	cout << x4 << endl;
  	cout << y4 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int count=0;
  rep(i,n){
    if(s[i]=='R'){
      count ++;
    }
  }
  if(count>n-count){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
  
}


Measured memory_bytes: 256
x1,y1,x2,y2 = map(int,input().split())

vec = [x2-x1,y2-y1]

x3 = x2 - vec[1]
y3 = y2 + vec[0]
x4 = x3 - vec[0]
y4 = y3 - vec[1]

print(x3,y3,x4,y4)


Measured memory_bytes: 2940
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
map<int,ll> mp;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    mp[a]++;
    mp[b]++;
}
for(auto p:mp){
    if(p.se%2==1){
        cout<<"NO"<<endl;
        return 0;
    }
}
cout<<"YES"<<endl;
}

Measured memory_bytes: 5632
#include<stdio.h>
int main () {
  int a, b;
  scanf("%d", &a);
  scanf("%d", &b);
  if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0)
    printf("Possible\n");
  else
    printf("Impossible\n");
}


Measured memory_bytes: 128
using System; 
using System.Text; 
using System.Collections.Generic;
using System.Linq; 
using E = System.Linq.Enumerable; 

class Program {
     static long waru = 1000000007;
     static void Main(string[] args) {
     //入力を受け取る
     var X = int.Parse(Console.ReadLine());
     
     var sum   = 0L;
     long i;
     
     for(i = 1;sum <X;i++){
         sum += i;
     }
     
     if(sum == X){
         Console.WriteLine(i-1);
     }else{
         Console.WriteLine(i-1);
     }
     
     }
     
     static long kaijo(long num){
         long res =1;
        // Console.WriteLine(res);
         while(num != 1){
             res *= (num%waru);
             num--;
             res = res%waru;
         }
         
         return res%waru;
    　}
}
     
     
     
     
     


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define int long long
int inf = 10e17;
#define mod 1000000007
int findLowerBound(
    vector<pair<int, int>> &arr,
    pair<int, int> &p)
{

    auto low = lower_bound(arr.begin(),
                           arr.end(), p);

    return low - arr.begin();
}
int findUpperBound(
    vector<pair<int, int>> &arr,
    pair<int, int> &p)
{
    auto up = upper_bound(arr.begin(),
                          arr.end(), p);

    return up - arr.begin();
}
bool vis[200005];
vector<int> vec[100005];
int child[100005];
int div1[100005];
void dfs(int node)
{
    vis[node] = 1;
    for (int i = 0; i < vec[node].size(); i++)
    {
        if (!vis[vec[node][i]])
        {
            dfs(vec[node][i]);
            child[node] += child[vec[node][i]];
        }
    }
}
void belman(int n, int m, vector<pair<int, pair<int, int>>> vec, int dis[])
{
    for (int i = 0; i <= n + m - 1; i++)
    {
        for (int j = 0; j < vec.size(); j++)
        {
            int u = vec[j].second.first;
            int v = vec[j].second.second;
            int w = vec[j].first;

            if (dis[u] + w < dis[v])
            {
                dis[v] = dis[u] + w;
            }
        }
    }
}
int fun(int a, int b)
{
    if (a > b)
        return 0;
    if (a == b)
        return 1;
    else
    {
        return fun(a + 1, b) + fun(a, b - a);
    }
}
int32_t main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    string str;
    cin >> str;
    cout << "ABC" << str;

    return 0;
}


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

using namespace std;

int main(){
    int q1, money, cost1, cost2, q2;
    while(cin >> q1, q1){
        cin >> money >> cost1 >> cost2 >> q2;
        bool is = false;
        for(int i=q2; 0 <= i; i--){
            int g1 = i;
            if(money < cost1*g1) continue;
            int g2 = (money-cost1*g1)/cost2;
            if(g2 < 0 || g1+g2 < q1 || g1 == 0) continue;
            else {
                is = true;
                cout << g1 << " " << g2 << endl;
                break;
            }
        }
        if(!is) cout << "NA" << endl;
    }
}

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N + 1; i++) {
    if (i * i > N) {
      cout << (i - 1) * (i - 1) << endl;
      break;
    }
    else if (i * i == N) {
      cout << i * i << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector < int > day[N];
int main(){
	long long n , m , res = 0 , a , b;  
	cin >> n >> m;
	for(int i = 0; i < n; i ++)
		scanf("%d%d" , &a , &b) , day[a].push_back(b);
	for(int i = 1; i <= m; i ++) sort(day[i].rbegin() , day[i].rend());
	multiset < long long > s;
	for(int i = 1; i <= m; i ++){
		for(int j = 0; j < day[i].size(); j ++)
			s.insert(day[i][j]);
		if(!s.size()) continue;
		res	 += *s.rbegin();
		s.erase(s.find(*s.rbegin()));
	}
	cout << res << "\n";
} 

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll h[1000000];
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll a[n], sum=0;
    for (int i = 0; i < n; ++i)
    {
    	cin >> a[i];
    	h[a[i]]++;
    	sum+=a[i];
    }
    ll q;
    cin >> q;
    for (int i = 0; i < q; ++i)
    {
    	ll x, y;
    	cin >> x >> y;
    	sum+=(y-x)*h[x];
    	h[y]+=h[x];
    	h[x]=0;
    	cout << sum <<"\n";
    }

    return 0;
}

Measured memory_bytes: 5216
s=input()
if s[0]!='A':
	print('WA')
	exit()
if s[1].isupper() or s[-1].isupper():
	print('WA')
	exit()
if s[2:-1].count('C')!=1:
	print('WA')
	exit()
for i in s[2:-1]:
	if i.isupper() and i!='C':
		print('WA')
		exit()
print('AC')

Measured memory_bytes: 3060