akhauriyash/Code-Regression huggingface dataset:
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 
using namespace std;
//-------------------------------------------
typedef pair<ll,ll> P;
int main(void){
    ll A,B;cin>>A>>B;
    cout<<max(max(A+B,A*B),A-B)<<"\n";
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next());

		HashMap<Integer, Integer> hm = new HashMap<>();

		for (int i = 0; i < n; i++) {
			int a = Integer.parseInt(sc.next());
			hm.put(a, hm.getOrDefault(a, 0) + 1);
		}

		int count = 0;
		for (int key : hm.keySet()) {
			if (hm.get(key) % 2 == 1) {
				count++;
			}
		}

		System.out.println(count);
		sc.close();
	}
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int H, W, N;
string s;
string c[1001];
int nex[4][1001000];
int mincost[1001][1001];
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

struct State {
  int y, x, cost;
  State(){}
  State(int y, int x, int cost):y(y), x(x), cost(cost){}
  bool operator < (const State& s) const {
    return cost > s.cost;
  }
};

bool in(int y, int x) {
  return 0<=y&&y<H&&0<=x&&x<W&&c[y][x]!='#';
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(cin >> H >> W >> N, H) {
    cin >> s;
    rep(i, H) cin >> c[i];

    vint sum(N+1);
    rep(i, N) {
      if(s[i] == 'L') sum[i+1] = sum[i]+1;
      else sum[i+1] = sum[i]+3;
      sum[i+1] %= 4;
    }
    memset(nex, -1, sizeof(nex));
    rep(i, 4) {
      int p = -1;
      for(int j = N; j >= 0; --j) {
	if(sum[j] == i) p = j;
	if(~p) nex[i][j] = p-j;
      }
    }

    int sy, sx, gy, gx;
    rep(i, H) rep(j, W) {
      if(c[i][j] == 'S') sy = i, sx = j;
      else if(c[i][j] == 'G') gy = i, gx = j;
    }

    priority_queue<State> que;
    fill(mincost[0], mincost[1001], inf);
    mincost[sy][sx] = 0;
    que.push(State(sy, sx, 0));
    while(!que.empty()) {
      State st = que.top(); que.pop();
      if(st.y == gy && st.x == gx) break;
      if(mincost[st.y][st.x] < st.cost) continue;
      rep(i, 4) {
	int ny = st.y + dy[i], nx = st.x + dx[i];
	if(!in(ny, nx)) continue;
	if(nex[i][st.cost] == -1) continue;
	if(st.cost+nex[i][st.cost] < mincost[ny][nx]) {
	  mincost[ny][nx] = st.cost + nex[i][st.cost];
	  que.push(State(ny, nx, mincost[ny][nx]));
	}
      }
    }
    cout << (mincost[gy][gx] == inf ? "No" : "Yes") << endl;
  }

  return 0;
}



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

using namespace std;

#define inf 1<<30
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;
struct UnionFind{
	vector<int> par, rank;

	UnionFind(){};
	UnionFind(int n){
		par.resize(n), rank.resize(n);
		for(int i = 0; i < n; i++)
			par[i] = i, rank[i] = 0;
	};
	int find(int n){
		if(par[n] == n) return n;
		return par[n] = find(par[n]);
	};
	bool isSame(int a, int b){
		return find(a) == find(b);
	};
	void marge(int a, int b){
		a = find(a);
		b = find(b);
		if(a == b) return;
		if(rank[a] < rank[b]) swap(a,b);
		if(rank[a] == rank[b]) rank[a]++;
		par[b] = a;
		return;
	};
};

int N, M;
int id[100001] = {};
UnionFind uf;

int main(){
	cin >> N >> M;
	uf = UnionFind(N+1);
	int in;
	for(int i = 1; i <= N; i++){
		cin >> in;
		id[in] = i;
	}
	int a, b;
	for(int i = 0; i < M; i++){
		cin >> a >> b;
		uf.marge(a,b);
	}
	int cnt = 0;
	for(int i = 1; i <= N; i++)
		if(uf.isSame(i, id[i]))
			cnt++;

	cout << cnt << endl;

	return 0;
}

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

using namespace std;

#define int 		long long
#define endl		"\n"
#define mod			1000000007
#define inf			1e12
#define IOS			ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int32_t main() {

	IOS;

	int n;
	cin >> n;
	if(n >= 30)
		cout << "Yes\n";
	else
		cout << "No\n";

	return 0;
}

Measured memory_bytes: 3644
#include <cstdio>
const int N = 200;
int n, l, r, m;
char L, R, M;
char ans[5], s[N];

void read_ans()
{
	printf("\n");
	fflush(stdout);
	scanf("%s", ans);
}

char ask(int x)
{
	printf("?");
	for (int i = 1; i <= n; ++i)
		printf(" %d", x + i - 1);
	read_ans();
	return ans[0];
}

char ask(int x, int y)
{
	printf("?");
	if (x < y || y + n < x)
	{
		printf(" %d", x);
		for (int i = 1; i <= n - 1; ++i)
			printf(" %d", y + i);
		read_ans();
		return ans[0];
	} 
	else 
	{
		for (int i = 0; i <= n; ++i)
			if (y + i != x)
				printf(" %d", y + i);
		read_ans();
		return ans[0] ^ 'R' ^ 'B';
	}
}

int main()
{
	scanf("%d", &n);
	l = 1, L = ask(l);
	r = n + 1, R = ask(r);
	while (l + 1 < r)
	{
		m = (l + r) / 2;
		M = ask(m);
		if (L == M)
			l = m;
		if (R == M)
			r = m;
	}
	for (int i = 1; i <= 2 * n; ++i)
		s[i - 1] = ask(i, l);
	printf("! %s\n", s);
	fflush(stdout);
}


Measured memory_bytes: 628
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int N;
int t[1024];
int res[1024];
int M,D,h,m,p;char e[2];

int main(){
  while(scanf("%d", &N) && N){
    fill(t,t+1024, INF);
    memset(res, 0,sizeof(res));
    int  godless = INF;
    rep(i,N){
      scanf("%d/%d %d:%d %s %d", &M,&D,&h,&m,e,&p);
      if(p==0){
	if(e[0]=='I') godless = h*60+m;
	else{
	  rep(i, 1024) res[i] += max(0, min(h*60+m-t[i], h*60+m-godless));
	  godless = INF;
	}
      }else{
	if(e[0]=='I') t[p] = h*60+m;
	else{
	  res[p] +=  max(0, min(h*60+m-t[p], h*60+m-godless));
	  t[p] = INF;
	}
      }
    }
    int ans=0;
    rep(i,1024)  ans = max(ans, res[i]);
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 1200
import math

def prime(x):
    for i in range(2, int(math.sqrt(x))+1):
        if x%i==0:
            return 0
    return 1

prime_list = []
for i in range(2,50022):
    if prime(i)==1:
        prime_list.append(i)
while True:
    try:
        n = int(input())
    except:
        break
    print(max([x for x in prime_list if x < n]), end=' ')
    print(min([x for x in prime_list if x > n]))


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

int main() {
    int n;
    std::cin >>n;
    
    int k;
    cin>>k;
    
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    
    int dp[k+1]={0};
    dp[0]=0;
    for(int i=0;i<=k;i++)
    {
        for(int j=0;j<n;j++)
        {
           if(i-a[j] >=0 && dp[i-a[j]]==0)
            dp[i]=1;
        }
    }//for(int i=0;i<=k;i++)cout<<dp[i]<<endl;cout<<endl;
    cout<<(dp[k]?"First":"Second");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll N,A,B;
vector<ll> H;

void input(){
    fast_io();
    cin >> N >> A >> B;
    H = fetch_vec<ll>(N);
}

bool chk(ll x){
    vector<ll> tmp = H;
    for (int i = 0; i < N; i++)
    {
        tmp[i] -= x*B;
    }
    ll diff = (A-B);
    ll cnt = 0;
    for (int i = 0; i < N; i++)
    {
        if(tmp[i]<0) continue;
        cnt += (tmp[i]+diff-1)/diff;
    }
    return (cnt<=x);
}

int solve(){
    ll ng = 0, ok = 1e9;
    while(ok-ng>1){
        ll mid = (ok+ng)/2;
        if(chk(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;
    auto adjacency_list = vector<vector<int>>(N);
    for (auto i = 0; i < N-1; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;

        adjacency_list[a].push_back(b);
        adjacency_list[b].push_back(a);
    }

    struct State { int vertex, mark; };
    const auto compare = [](const State a, const State b) { return a.mark < b.mark; };
    auto queue = priority_queue<State, vector<State>, decltype(compare)>(compare);

    auto seen = vector<bool>(N);
    auto marks = vector<int>(N);
    int K; cin >> K;
    for (auto i = 0; i < K; i++)
    {
        int v, m; cin >> v >> m;
        v--;

        seen[v] = true;
        marks[v] = m;
        for (const auto w : adjacency_list[v])
            queue.push({w, m-1});
    }

    while (!queue.empty())
    {
        const auto s = queue.top(); queue.pop();
        if (!seen[s.vertex])
        {
            seen[s.vertex] = true;
            marks[s.vertex] = s.mark;
            for (const auto w : adjacency_list[s.vertex])
                queue.push({w, s.mark-1});
        }
    }

    auto ok = true;
    for (auto v = 0; v < N; v++)
        for (auto w : adjacency_list[v])
            ok &= abs(marks[v]-marks[w]) == 1;

    if (ok)
    {
        cout << "Yes" << "\n";
        for (const auto x : marks) cout << x << "\n";
    }
    else cout << "No" << "\n";
}



Measured memory_bytes: 8692
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9;
struct Dbg { static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto o(C *x)->decltype(os << *x, 0);
template<class C> static char o(...);
template<class C> typename enable_if<sizeof o<C>(0)!=1,Dbg&>::type operator<<(const C &x) {os<<x; return *this;}
template<class C> Dbg &dump(C b, C e) {
    for (struct{C i;int j;} i={(*this<<"\n[",b),0}; i.i!=e and i.j<26; i.i++, i.j++) *this<<", "+2*(i.i==b)<<*i.i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof o<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<!is_same<C, const char>::value, Dbg&>::type operator<<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator<<(const pair<B, C> &x) {return *this<<'{'<<x.first<<", "<<x.second<<'}';}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#define cbug(a, args...) if (a) bug(args);
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = -1;

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11), cout.setf(ios::fixed);
    ll a;
    cin >> a;
    cout << a+a*a+a*a*a << '\n';
}

Measured memory_bytes: 3640
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int h, w, n;
int sy, sx;
string s, t;

map<char, int> tx{{'L', -1},{'R', +1},{'U', 0},   {'D', 0}, };
map<char, int> ty{{'L', 0},{'R', 0},{'U', -1},   {'D', +1}, };

void NO() {
  cout << "NO" << endl;
  exit(0);
}

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  cin >> h >> w >> n;
  cin >> sy >> sx;
  sy--, sx--;

  cin >> s >> t;


  int Lx = -1, Rx = w;
  int Ly = -1, Ry = h;


  for(int i = n - 1; i >= 0; i--) {
    int x1, x2, y1, y2;
    x1 = tx[s[i]];
    x2 = tx[t[i]];
    y1 = ty[s[i]];
    y2 = ty[t[i]];

    if(x2 == -1 && Rx < w) Rx++;
    if(x2 == +1 && Lx >= 0) Lx--;

    if(x1 == -1) Lx++;
    if(x1 == +1) Rx--;
    if(Lx + 1 == Rx) NO();

    if(y2 == -1 && Ry < h) Ry++;
    if(y2 == +1 && Ly >= 0) Ly--;

    if(y1 == -1) Ly++;
    if(y1 == +1) Ry--;
    if(Ly + 1 == Ry) NO();
  }
  if(sx <= Lx) NO();
  if(sy <= Ly) NO();
  if(sx >= Rx) NO();
  if(sy >= Ry) NO();
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 920
#include<stdio.h>

int main(){
    int a[100][100];
    int b[100],c[100];
    int i,j;
    int n,m;
    scanf("%d%d\n",&n,&m);
   
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for (j=0;j<m;j++){
        scanf("%d",&b[j]);
    }
    for (i=0;i<n;i++){
        for(j=0;j<m;j++){
            c[i]+= a[i][j]*b[j];
        }
    }
    for(i=0;i<n;i++){
        printf("%d\n",c[i]);
    }



  return 0;

}


Measured memory_bytes: 2088
ans = 0
P = 10**9+7
n = int(input())
c = list(map(int, input().split()))
c = sorted(c)

for i in range(n):
    alr = pow(4, i, P)
    use_bit = n - 1 - i
    flip = pow(2, use_bit, P)
    ret = 1
    if use_bit > 0:
        ret = (pow(2, use_bit, P) + use_bit*pow(2, use_bit-1, P))%P
    ans = (ans + alr*flip*ret*c[i])%P

print((ans*2)%P)


Measured memory_bytes: 26024
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;

const double eps = 1e-8;

int s,a,c;

double getH(vector<int> &input){
	double H=0;

	const int n=input.size();

	vector<int> R;
	R.push_back(s);
	for(int i=1;i<n;i++) R.push_back((a*R[i-1]+c) % 256);

	vector<int> occ(256,0);
	for(int i=1;i<R.size();i++) occ[(R[i]+input[i])%256]++;

	for(int i=0;i<256;i++){
		if(occ[i]!=0) H-=(occ[i]/(double)n)*log((occ[i]/(double)n));
	}

	return H;
}

int main()
{
	int n;
	while(cin>>n,n){
		vector<int> input(n+1);
		input[0]=-1;
		for(int i=1;i<=n;i++) cin>>input[i];

		double H=1<<20;

		int res[3];

		for(s=0;s<=15;s++){
			for(a=0;a<=15;a++){
				for(c=0;c<=15;c++){
					double tmp=getH(input);
//					printf("s=%d a=%d c=%d -> %f\n",s,a,c,tmp);
					if(H-tmp>eps){H=tmp;res[0]=s;res[1]=a;res[2]=c;}
				}
			}
		}

		printf("%d %d %d\n",res[0],res[1],res[2]);

	}

	
	return 0;
}

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

using namespace std;
int main(){

	int N;
	int p[15];
	int ans=0;

	cin >> N;

	for(int i=0; i<N; i++){

		cin >> p[i];

	}

	sort(p,p+N);

	p[N-1]=p[N-1]/2;

	for(int i=0; i<N; i++) ans+=p[i];

	cout <<ans<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <list>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;//print
typedef long long ll;
using namespace std;

string mozi = "abcdefghijklmnopqrstuvwxyz";
int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    ll n;
    n = s.length();
    rep(i,26){
        char now = mozi[i];
        int j = 0;
        bool flag = true;
        while(j<n){
            if(now==s[j]){
                flag = false;
                break;
            }
            j++;
        }
        if(flag){
            cout << now << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


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

using namespace std;

using ll = long long;

template <typename T>
struct SparseTable {
    int n;
    vector< vector<T> > table;
    vector<int> log_table;

    //使うときは、この2つを適宜変更する
    static T merge(T x, T y);
    static T INITIAL_VALUE;

    SparseTable(const vector<T>& v) {
        n = v.size();

        log_table.resize(n + 1, 0);
        for (int i = 2; i <= n; i++) {
            log_table[i] = log_table[i >> 1] + 1;
        }

        table.resize(log_table[n] + 1, vector<T>(n));
        for (int i = 0; i < n; i++) {
            table[0][i] = v[i];
        }

        size_t sz = table.size();
        for (int i = 1; i < sz; i++) {
            for (int j = 0; j + (1 << i) <= n; j++) {
                table[i][j] = merge(table[i - 1][j], table[i - 1][j + (1 << (i - 1))]);
            }
        }
    }

    //区間[l, r)に対するクエリに答える
    T query(int l, int r) {
        if (l == r) return INITIAL_VALUE;
        int k = log_table[r - l];
        return merge(table[k][l], table[k][r - (1 << k)]);
    }
};

//使うときは以下2つを変更
//非可換の場合は順序に注意！！！
template <typename T>
T SparseTable<T>::merge(T x, T y) {
    return max(x, y);
}

//本来は必要無いはずだけど、区間幅0のときにバグるので一応単位元を用意
//(区間幅0のときは例外処理した方が良い？)
template <typename T>
T SparseTable<T>::INITIAL_VALUE = 0;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    SparseTable<int> st(a);
    for (int i = 0; i < n; i++) {
        cout << max(st.query(0, i), st.query(i + 1, n)) << "\n";
    }
    return 0;
}


Measured memory_bytes: 17264
ny = input().split()
n = int(ny[0])
yen = int(ny[1])

ichiman = -1
gosen = -1
sen = -1
flg = False

for x in range(n + 1):
	if flg : break
	for y in range(n-x+1):
		if 10000*x + 5000*y + 1000*(n-x-y) == yen:
			flg = True
			ichiman = x
			gosen = y
			sen = n-x-y
			break

print(ichiman,gosen,sen)

Measured memory_bytes: 3064
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr;
}

impl<'a> Parse for std::str::SplitWhitespace<'a> {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n = iter.to();
    let v = (0..n).map(|_| iter.to::<u32>()).collect::<Vec<_>>();
    let mut vv = v.into_iter().enumerate().collect::<Vec<_>>();
    vv.sort_by(|a, b| a.1.cmp(&b.1));

    println!(
        "{}",
        vv.into_iter()
            .map(|x| (x.0 + 1).to_string())
            .collect::<Vec<_>>()
            .join(" ")
    );
}

Measured memory_bytes: 12540
#include<iostream>
using namespace std;
string s;int i,g=0;
int main()
{
	cin>>s;
	for(i=0;i<s.size();i++)if(s[i]=='C')break;
	for(;i<s.size();i++)if(s[i]=='F'){g=1;break;}
	if(g)cout<<"Yes";
	else cout<<"No";
}

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

ll divisor_half(ll n, vector<ll>& d){
  ll cnt = 0;
  for(ll i=1; i*i<=n; i++){
    if(n%i==0){
      d.push_back(i);
      cnt++;
    }
  }
  return cnt;
}

int main(){
  ll n;
  cin>>n;
  ll ans = n;
  vector<ll> d;
  ll num = divisor_half(n, d);
  /*
  for(int i=0; i<num; i++){
    ans = min(ans, d[i]+n/d[i]-2);
    cout<<d.at(i)<<" -ans-> "<<ans<<endl;
  }
  */
  ans = d[num-1]+n/d[num-1]-2;
  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;
using ll = long long;



int main(){
    ll A;
    double B;
    cin >> A >> B;
    //cout << A*B  << endl;
    ll BB = B*100 + 0.05;
    //cout << BB <<endl;
    //cout << setprecision(15) << BB << endl;
    //cout << (A*BB) << endl;
    ll ans = (A*BB)/100;
    cout << ans << endl;
    
}


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

int		main(void)
{
	ll a, b, c;

	cin >> a >> b >> c;
	ll x = c - b - a;
	if (x > 0 && 4 * a * b < x * x)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


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

int main(){
 int k , s;
 int ans = 0;
 cin >> k >> s;
 for(int i = 0; i <= k; i++){
    for(int j = 0; j <= k; j++){
	    if(s - (i + j) <= k && (i + j <= s)) ans++;
	    //cout << i << " " << j << "\n";
	   //for(int z = 0; z <= k; z++){
		      //if(i + j + z == s) ans++;   
		   //}
	  }	 
 }	
 cout << ans << " ";	
 return 0;	
}

Measured memory_bytes: 3536
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/

void solve()
{
    ll n;
    cin>>n;

    pair<ll,ll> a[n];

    f(i,n)
    {
        cin>>a[i].ff;
        a[i].ss=i+1;
    }

    sort(a,a+n);

    f(i,n) cout<<a[i].ss<<" ";
    cout<<"\n";

    return;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 2432
MOD = 10**9+7
n,m = gets.chomp.split(" ").map(&:to_i)
a = []
m.times do |i|
  a[i] = gets.to_i
end
dp = [1,1,2]
for i in 3..n
  dp[i] = dp[i-1] + dp[i-2]
end
indi = 0
count = 1
m.times do |i|
  count = count * dp[a[i]-1 - indi]
  count %= MOD
  indi = a[i]+1
  if i>0
    if a[i]-1 == a[i-1]
      puts 0
      exit
    end
  end
end
count = count * dp[n - indi]
count %= MOD
puts count

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

int dx[] = {+1,-1, 0, 0};
int dy[] = { 0, 0,+1,-1};
int tb[10][10];
int tf[10][10];

int n,t,sum;
vector<int> sx,sy;

bool dfs(int x, int y, int s, int c, int m)
{
	//cout << x << " " << y << " " << s << " " << c << " " << m << endl;

	int tx,ty,ts,tc,tm,f;

	for(int i=0; i<4; i++)
	{
		f  = false;
		tc = c;
		ts = s+1;
		tx = x+dx[i];
		ty = y+dy[i];
		tm = m+tb[tx][ty];

		if(tf[tx][ty]==0) continue;
		if(tb[tx][ty]<=0) continue;

		if(tm>0) continue;
		if(tm==0)
		{
			tc++;

			if(tc==sx.size())
			{
				if(ts==n*n)
				{
					return true;
				}
				else
				{
					return false;
				}
			}
			ts++;
			tx = sx[tc];
			ty = sy[tc];
			tm = tb[tx][ty];
			f  = true;
			tf[x+dx[i]][y+dy[i]]=0;
		}

		tf[x][y]=0;
		if(dfs(tx,ty,ts,tc,tm)) return true;
		tf[x][y]=1;

		if(f)
		{
			tf[x+dx[i]][y+dy[i]]=1;
		}
	}
	return false;
}

int main()
{
	while(cin >> n, n)
	{
		sum = 0;
		sx.clear();
		sy.clear();

		for(int i=0; i<100; i++)
		{
			tb[i/10][i%10] = 0;
			tf[i/10][i%10] = 1;
		}

		for(int i=0; i<n*n; i++)
		{
			cin >> t; sum+=t;
			tb[(i/n)+1][(i%n)+1] = t;

			if(t<0)
			{
				sx.push_back((i/n)+1);
				sy.push_back((i%n)+1);
			}
		}

		// »è»Ì1
		if(sum!=0) { cout << "NO\n"; continue; }

		if(dfs(sx[0],sy[0],1,0,tb[sx[0]][sy[0]]))
		{
			cout << "YES\n";
		}
		else
		{
			cout << "NO\n";
		}
	}

	return 0;
}

Measured memory_bytes: 904
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;


int main() {
	string n; cin >> n;
	ll ans = 0;
	for (int i = 0; i <= (int)n.length(); i++) {
		ll cur = 0;
		for (int j = 0; j < (int)n.length(); j++) {
			if (j < i) cur += n[j] - '0';
			else if (j == i) cur += n[j] - '1';
			else cur += 9;
		}
		ans = max(ans, cur);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main(){
  int N = 0, A = 0;
  cin >> N;
  cin >> A;
  
  int surplus = N % 500;
  if (surplus <= A) {
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    map<string,int> s;
    rep(i,n){
        string t;
        cin >> t;
        s[t] += 1;
    }
    int max_c = 0;
    for(auto p : s) max_c = max(max_c,p.second);
    vector<string> ans;
    for(auto p : s){
        if(p.second == max_c) ans.push_back(p.first);
    }
    for(auto x : ans) cout << x << endl;
    return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;

    auto adjacency_list = vector<vector<int>>(N);
    for (auto i = 0; i < N-1; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        adjacency_list[a].push_back(b);
        adjacency_list[b].push_back(a);
    }

    auto matched = vector<bool>(N);
    const function<void(int, int)> dfs = [&](const int v, const int parent)
    {
        for (const auto child : adjacency_list[v]) if (child != parent)
        {
            dfs(child, v);
            if (!matched[child] && !matched[v])
                matched[child] = matched[v] = true;
        }
    };
    dfs(0, -1);

    auto all_matched = true;
    for (const auto x : matched) all_matched &= x;
    cout << (all_matched ? "Second" : "First") << endl;
}


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

typedef long long ll; // -9,223,372,036,854,775,808 から 9,223,372,036,854,775,807

template <class T> using vec = std::vector<T>;
template <class T> using vec2 = vec<vec<T>>;
template <class T> using vec3 = vec<vec<vec<T>>>;

#define DEBUG

void solve(long long N){
    ll res = 0;
    for(int i=1; i <= N; i++){
        if(i % 3 != 0 && i % 5 != 0){
            res += i;
        }
    }
    cout << res << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int n = sc.nextInt();
        comb();
        for(int i=2; i<=k*2; i++) {
            System.out.println(solve(k, n ,i));
        }
    }

    public static final long MOD = 998244353;

    public static long solve(int k, int n, int i) {
        long res = 0;
        i = Math.min(i, k * 2 + 2 - i);
        int s = 0;
        if(i%2 == 0 ) {
            s = 1;
        }
        int p = (i-1) / 2;
        int r = k - s - p * 2;
        if(s == 1) {
            res += s2(n, p, r);
            res += s2( n-1, p, r);
        } else {
            res += s2(n, p, r);
        }
        return res % MOD;
    }

    public static long s2(int n, int p, int r) {
        long res = 0;
        long mult = 1;
        for(int i=0; i<=p; i++) {
            if(i > n) break;
            int a = r + i;
            int b = n - i;
            long add = (comb[p][i] * comb[a + b - 1][b]) % MOD;
            res += (add * mult) % MOD;
            res %= MOD;
            mult *= 2;
            mult %= MOD;
        }
        return res % MOD;
    }

    static long[][] comb = new long[4001][4001];

    public static void comb() {
        comb[0][0] = 1;
        for(int i=1; i<=4000; i++) {
            for(int j=0; j<=i; j++) {
                if(j > 0) {
                    comb[i][j] += comb[i-1][j-1];
                }
                comb[i][j] += comb[i-1][j];
                comb[i][j] %= MOD;
            }
        }
    }
}


Measured memory_bytes: 166216
import sys
s=input()

check=1
if s[-1]=="1":
    check=0

if s[0]=="0":
    check=0

n=len(s)
for i in range(n//2):
    if s[i]!=s[n-2-i]:
        check=0

if check==0:
    print(-1)
    sys.exit()


print(1,2)
next=2
for i in range(1,n-1):
    print(next,i+2)
    if s[i]=="1":
        next=i+2

Measured memory_bytes: 4648
#include<iostream>

using namespace std;

int main(){
  
  char str[105];
  
  cin>>str;
  
  int l=strlen(str);
  
  for(int i=0;i<l;i+=2){
    if(str[i]=='L'){
      
      cout<<"No\n";
      return 0;
    }
  }
  for(int i=1;i<l;i+=2){
    if(str[i]=='R'){
      cout<<"No\n";
      return 0;
    }
  }
  
  cout<<"Yes\n";
  
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll a, b, c, k, ans;

int main() {
	fastio; cin >> a >> b >> c >> k;
	ans += min(a, k); k -= a; k -= b;
	ans -= max(min(k, c), 0ll);
	cout << ans;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod=1e9+7;
 
mat mul(mat t,mat u){
  mat v(t.size());
  for(int i=0;i<(int)t.size();i++)
    v[i].resize(t.size());
 
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      v[i][j]=0;
      for(int k=0;k<2;k++){
        v[i][j]+= t[i][k]*u[k][j];
        v[i][j]%=mod;
      }
    }
  }
  return v;
}
 
ll fib(ll x){
  if(x<=1)return 1;
 
  mat A( 2, vec(2,0));
  mat B( 2, vec(2,0));
  A[0][0]=1;
  A[1][1]=1;
  B[0][0]=1;
  B[0][1]=1;
  B[1][0]=1;
  ll n=x;
  while(n>0){
    if(n%2==1)A=mul(A,B);
    n/=2;
    B=mul(B,B);
  }
 
  return (A[1][0]+A[1][1])%mod;
}
 
ll solve(ll si,ll k){
  ll num=(si+1)/2;
  k--;
  ll d;
  if( num/2+num%2 > k ){
    d=k*2;
  }else{
    ll nk= k - (num/2+num%2);
    if(num%2==0){
      d=num-1-nk*2;
    }else{
      d=num-2-nk*2;
    }
  }
  return fib(si-d)* fib(d+1) % mod;
}
 
 
ll func(ll si){
  ll base=si/2;
  ll res = (1+base)*base/2;
  res*=2;
  if(si%2==1)res+=(si+1)/2;
  return res;
}
 
int main(){
  ll K;
  cin>>K;
  ll left=1,right=2000000000LL,mid;
  while(left<right){
    mid=(left+right)/2;
    if( func(mid) < K ) left=mid+1;
    else right=mid;
  }
  cout<<solve(left, K-func(left-1))<<endl;
  return 0;
}

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

int main(){
  char c;
  cin >> c;

  if((c=='a') || (c=='e') || (c=='i') || (c=='o') || (c=='u')) cout << "vowel" << endl;
  else cout << "consonant" << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> list=new ArrayList<>();
        for(int i=0;i<10;i++) {
            list.add(sc.nextInt());
        }
        list.stream().sorted(Comparator.reverseOrder()).limit(3).forEach(System.out::println);
    }
}


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

using namespace std;
using LL = long long;

const int MOD = 1e9+7;

class Edge{
public:
    LL from,to, value;
    Edge(int f,int t, int c){
        from = f;
        to = t;
        value = c;
    }
};

int main(){
    int n,m,a;
    while(cin >> n >> m >> a){
        if(n == 0 && m == 0 && a == 0)return 0;
    map<pair<int, int>, int> mp;
    for(int i = 0;i < m;i++){
        int h,p,q;cin >> h >> p >> q;
        mp[make_pair(h, p)] = q;
        mp[make_pair(h, q)] = p;
    }
    for(int i = 2000;i >= 0;i--){
        if(mp.find(make_pair(i, a)) != mp.end()){
            a = mp[make_pair(i, a)];
        }

    }
    cout<<a<<endl;
    }
}



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

int main(void) {
    int p[5], last = 0, mi = 10, div[5];
    for (int i = 0; i < 5; i++) {
        cin >> p[i];
        div[i] = p[i] % 10;
        if (div[i] > 0 && div[i] < mi) {
            mi = div[i];
            last = i;
        }
    }
    int sum = p[last];
    for (int i = 0; i < 5; i++) {
        if (i == last) {
            continue;
        }
        sum += (p[i] / 10) * 10;
        sum += (div[i] > 0) ? 10 : 0;
    }
    cout << sum << "\n";
}


Measured memory_bytes: 256
A,B,C,D = map(int,input().split())

Takahashi_HP = A
Takahashi_Damage = B
Aoki_HP = C
Aoki_Damage = D

while Takahashi_HP > 0 or  Aoki_HP > C:
    Aoki_HP -= Takahashi_Damage
    if Aoki_HP <= 0:
        print('Yes')
        break
    Takahashi_HP -= Aoki_Damage
    if Takahashi_HP <= 0:   
        print('No')
        break

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

using namespace std;
template <typename T> void print(T vec) {for(auto d: vec) cout<<d<<' ';cout<<'\n';}
template<typename T> void print2D(T mat) {for(auto vec:mat) print(vec);}

typedef long long int ll;

int n;

void solution(vector<ll> &A) {
    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1));
    for(int R = 0; R < n; R++) {
        for(int L = R; L >= 0; L--) {
            if(L == R) dp[L][R] = A[L];
            else dp[L][R] = max(A[L] - dp[ L + 1][R], A[R] - dp[L][R - 1]);
        }
    }
    cout<<dp[0][n - 1]<<'\n';
    // print2D(dp);
}


int main() {

    cin>>n;
    vector<ll> A(n);
    for(int i = 0; i< n;i++) cin>>A[i];
    solution(A);
    return 0;
}

Measured memory_bytes: 70784
#include <stdio.h>

int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a==b){
			printf("Draw");
	} else if(a==1){
		printf("Alice");
	} else if(b==1){
		printf("Bob");
	} else if(a>b){
		printf("Alice");
	} else {
		printf("Bob");
	}
	return 0;
}

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

int main(){
    int num1, num2;
    bool check = true;
    cin >> num1 >> num2;
    while(num1 != 0 || num2 != 0){
        for(int i = 0; i < num1; ++i){
            if(i % 2 == 0){
                check = true;
            }
            else{
                check = false;
            }
            for(int j = 0; j < num2; ++j){
                if(check == true){
                    cout << "#";
                    check = false;
                }
                else{
                    cout << ".";
                    check = true;
                }
            }
            cout << endl;
        }
        cout << endl;
        cin >> num1 >> num2;
    }
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n, size, i, max=0;
    cin>>n;
  	string s[n];
  	map<string, int> count;
  	map<string, int>::iterator itr;
  	for(i=0; i<n; i++)
    {
      cin>>s[i];
      ++count[s[i]];
    }
  	size = count.size();
  	for(itr = count.begin(); itr != count.end(); ++itr)
    {
     	if(itr->second > max)
          max = itr->second;
    }
  	for(itr = count.begin(); itr != count.end(); ++itr)
    {
     	if(itr->second == max)
          cout<<itr->first<<'\n';
    }
	return 0;
}

Measured memory_bytes: 26752
sx,sy,tx,ty = map(int,input().split())
X = tx - sx
Y = ty - sy
# 1往復
ans = "U" * Y + "R" * X
ans += "D" * Y + "L" * X
# 2
ans += "L" + "U" * (Y + 1) + "R" * (X + 1) + "D"
ans += "R" + "D" * (Y + 1) + "L" * (X + 1) + "U"

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int a,b;
    cin >>a>>b;
 	int i=0;
    while(1)
    {
        if((a-1)*i+1>=b){
            cout<<i<<endl;
            break;
        }
        i++;
    }
    
}

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

int main()
{
	int n, x;
  	cin >> n;
  
  	x=n%10;
  
  	if(x==2 || x==4 || x==5 || x==7 || x==9) cout << "hon" << endl;
  	else if(x==0 || x==1 || x==6 || x==8) cout << "pon" << endl;
  	else if(x==3) cout << "bon" << endl;
  
  	return 0;
}

Measured memory_bytes: 3604
n,y = map(int,input().split())

flg = 0

for i in range(n+1):
    for j in range(n-i+1):
        if y == 10000 * i + 5000 * j + 1000 * (n-i-j) :
            flg = 1
            xx,yy,zz = i,j,n-i-j
if flg == 1:
    print(xx,yy,zz)
else:
    print(-1,-1,-1)
    


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
ll x;

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

  cin >> x;
  ll amari = (x-1)%11;
  if (amari <=5){
    cout << ((x-1)/11)*2+1 << "\n";
  } else{
    cout << ((x-1)/11)*2+2 << "\n";
  }
  
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    pair<int,int> *arr=new pair<int,int>[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i].first>>arr[i].second;
    }
    int flag=0;
    for(int i=0;i<=n-3;i++)
    {
        int flag1=0;
        int j=0;
        for(j=0;j<3;j++)
        {
            if(arr[i+j].first!=arr[i+j].second)
            {
                break;
            }
        }
        if(j==3)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3628
N = int(input())
A = [int(input()) for i in range(N)]

maxNum = max(A)
index = -1
for i in range(N):
    if A[i] == maxNum:
        index = i

for i in range(N):
    if i != index:
        print(maxNum)
        continue
    else:
        A.remove(maxNum)
        print(max(A))

Measured memory_bytes: 12532
#include<iostream>
#include<cmath>
#include<stdlib.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
int a[100010];
int main()
{
	int n;
	cin>>n;
	a[0]=0;
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=abs(a[i]-a[i-1]);
	}
	a[n+1]=0;
	sum+=abs(a[n+1]-a[n]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1]&&a[i]>a[i+1])
		{
			cout<<sum-abs(a[i]-max(a[i-1],a[i+1]))*2<<endl;
		}
		else if(a[i]<a[i-1]&&a[i]<a[i+1])
		{
			cout<<sum-abs(a[i]-min(a[i-1],a[i+1]))*2<<endl;
		}
		else
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll a[20];

ll dfs(int l,int r,int lx,int rx){
	if(l+1==r) return 0;
	ll ans=1e18;
	for(int i=l+1;i<r;i++) ans=min(ans,dfs(l,i,lx,lx+rx)+dfs(i,r,lx+rx,rx)+1ll*(lx+rx)*a[i]);
	return ans;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	printf("%lld\n",dfs(1,n,1,1)+a[1]+a[n]);

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    map<int,int>mp;
    mp[a]++;
    mp[b]++;
    mp[c]++;
    mp[d]++;
    
    string ans = "NO";
    
    if(mp[1]>0
    &&mp[9]>0
    &&mp[7]>0
    &&mp[4]>0)ans ="YES";
    cout << ans <<endl;
}


Measured memory_bytes: 256
point = int(input())

if 400 <= point <=599 :
    print("8")
elif 600<= point <= 799 :
    print("7")
elif 800 <= point <= 999 :
    print("6")
elif 1000 <= point <= 1199 :
    print("5")
elif 1200 <= point <= 1399 :
    print("4")
elif 1400 <= point <= 1599 :
    print("3")
elif 1600 <= point <= 1799 :
    print("2")
elif 1800 <= point <= 1999 :
    print("1")

Measured memory_bytes: 9184
#include<stdio.h>

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);

  if(a<b){
    printf("a < b\n");
  }
  if(a>b){  
    printf("a > b\n");
  }
  if(a==b){
    printf("a == b\n");
  }
  return 0;
}

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

#define   M             100005
#define   ll            long long
#define   PI            atan(1.0)*4
#define   mst(x,v)      memset(x,v,sizeof(x))
#define   inf           1e9
#define   rush()        int T;scanf("%d",&T);while(T--)

typedef   pair<int,int> P;

bool f,vis[M];
vector<P> E[M];
int dis[M],n,m;
P tmp;

void dfs(int u,int pre) {
	if(!f) return ;
	int sz=E[u].size();
	
	for(int i=0;i<sz;i++) {
		tmp=E[u][i];
		
		if(vis[tmp.first]) {
			if(dis[u] + tmp.second != dis[tmp.first]) {
				f=0;
				return ;
			}
		}
		else {
			vis[tmp.first]=1;
			dis[tmp.first]=dis[u]+tmp.second;
			dfs(tmp.first,u);
		}
	}
}

int main() {
	scanf("%d %d",&n,&m);
	
	for(int i=1;i<=m;i++) {
		int l,r,d;
		scanf("%d %d %d",&l,&r,&d);
		E[r].push_back(make_pair(l,d));
		E[l].push_back(make_pair(r,-d));
	}
	
	f=1;
	
	for(int i=1;i<=n;i++) {
		if(!vis[i]) {
			vis[i]=1;
			dfs(i,-1);
		}
	}
	
	puts(f?"Yes":"No");
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int n;
vector<set<int>> e;


int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	cin >> n;
	e.resize(n);
	rep(i, n - 1){
		int a, b; cin >> a >> b; a--; b--;
		e[a].insert(b);
		e[b].insert(a);
	}
	set<int> f, del;
	rep(i, n) if(e[i].size() == 1) f.insert(i);
	while(f.size()){
		int i = *f.begin(), j = *e[i].begin();
		f.erase(i); f.erase(j);
		del.insert(i); del.insert(j);
		for(int k : e[j]){
			e[k].erase(j);
			//dbg(i, j, k, e[k]);
			if(e[k].size() == 1 && !del.count(k)) f.insert(k);
			else f.erase(k);
		}
	}
	cout << (del.size() == n ? "Second" : "First") << endl;
	return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int n, s[15];
	
	while (cin >> n, n) {
		for_(i,0,n) cin >> s[i];
		
		bool update = 1;
		int ans = 0;
		
		while (update) {
			update = 0;
			
			map< int, int > cnt;
			for_(i,0,n) ++cnt[s[i]];
			
			for_(i,0,n) {
				if (s[i] != cnt[s[i]]) update = 1;
				s[i] = cnt[s[i]];
			}
			
			if (update) ++ans;
		}
		
		cout << ans << endl;
		for_(i,0,n) cout << s[i] << (i < n - 1 ? " " : "\n");
	}
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
int main()
{
	int n,h,w,i,j,k;
	cin>>n>>h>>w;
	i=max(h,w);
	j=min(h,w);
	cout<<(n-i+1)*(n-j+1);
}

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

public class Main {


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

		// input
		final int NUM = scan.nextInt();
		long[] needTime = new long[NUM];
		long[] deadLine = new long[NUM];
		for(int i = 0; i < NUM; i++){
			needTime[i] = scan.nextLong();
			deadLine[i] = scan.nextLong();
		}

		// sort
		for(int i = 0; i < NUM; i++){
			deadLine[i] = deadLine[i] * 10000000000L + needTime[i];
		}
		Arrays.sort(deadLine);
		for(int i = 0; i < NUM; i++){
			needTime[i] = deadLine[i] % 10000000000L;
			deadLine[i] = deadLine[i] / 10000000000L;
		}

		// check
		long sum = 0;
		boolean flag = true;
		for(int i = 0; i < NUM; i++){
			sum += needTime[i];
			if(sum > deadLine[i]){
				flag = false;
				break;
			}
		}

		// answer
		if(flag){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}


	}
}


Measured memory_bytes: 103812