akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 200000 + 10;

int n, a[maxn], b[maxn];
struct qnode{
	int w, u;
	qnode() {}
	qnode(int _w, int _u):w(_w), u(_u) {}

	friend bool operator < (qnode a, qnode b) {
		if(a.w != b.w) return a.w < b.w;
		return a.u < b.u;
	}
};
priority_queue<qnode> q;

inline void fail() {
	puts("-1");
	exit(0);
}

signed main() {
//	freopen("data.in","r",stdin);
  scanf("%lld", &n);
	for(int i = 1;i <= n;i ++) scanf("%lld", &a[i]);
	for(int i = 1;i <= n;i ++) scanf("%lld", &b[i]);
  while(!q.empty()) q.pop();
	int cnt = 0;
	for(int i = 1;i <= n;i ++) if(a[i] != b[i]) q.push(qnode(b[i],i)), cnt ++;
	for(int i = 1;i <= n;i ++) if(a[i] > b[i]) fail();
	int step = 0;
	while(!q.empty()) {
    if(!cnt) break;
		qnode now = q.top(); q.pop();
		int x, y, z;
		y = now.u;
		x = (y == 1) ? (n) : (y - 1);
		z = (y == n) ? (1) : (y + 1);
		if(b[x] + b[z] > b[y]) fail();
    int tmp = b[x] + b[z];
		int del = b[y] - a[y];
		int ds = del / tmp;
		step += ds; b[y] -= ds * tmp;
		if(b[y] == a[y]) cnt --;
		else if(b[y] < a[y]) fail();
		else q.push(qnode(b[y],y));
	}
	printf("%lld\n", step);
	return 0;
}


Measured memory_bytes: 9328
#include<stdio.h>
#define MAXN 1000000007
#define ll long long

int min(int a,int b){
    return a > b ? b : a;
}
int max(int a,int b){
    return a > b ? a : b;
}
int abs(int a){
    return a < 0 ? -a :a;
}
int main(){
    int a,b;

    scanf("%d%d",&a,&b);
    ll sum = 1;
    if(abs(a-b)>=2)
        sum = 0;
    else if(a==b){
        for(int i = 1; i <= a; i++){
            sum*=i;
            sum%=MAXN;
        }
        sum = sum*sum*2%MAXN;
    }
    else{
        for(int i = 1; i <= min(a,b); i++){
            sum*=i;
            sum%=MAXN;
        }
        sum = sum*sum%MAXN;
        sum = sum*max(a,b)%MAXN;
    }
    printf("%lld\n",sum);
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
struct P
{
    //string r;
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x>a.x;
//        return z>a.z;
    }
};
struct S
{
    //double a;
    int x,y;
};
vector<P> v[510];

int a,b,c,i,k,d,n,p,m,e,dy[15]={0,0,-1,1},dx[15]={-1,1};
int l[15010];
int o[13013];
int dz[10]={0,0,0,0,1,-1};

long long x,y,z,mod=1000000007;
P u[1021600];
int j[40040];
queue<int> q;
queue<int> q1;
stack<int> s,s1;
//queue<P> q;

//deque<int> de;
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,long long > p;
string r;
//char r[1000310];
//char r1[1000222];
bool as(P a,P b)
{
    return max(a.x,-a.x)<max(b.x,-b.x);
}





int f(int a)
{
    if(j[a]==a) return a;
    return j[a]=f(j[a]);
}

int main()
{
    scanf("%d",&a);
    if(a%10==9||a/10==9) puts("Yes");
    else puts("No");
}



Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007; // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const ld PI = acos((ld)-1);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(auto&& x: vec) is >> x;
  return is;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}

template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}

template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,x,m;cin>>n>>x>>m;

  map<ll,ll> ma;
  V<ll> v(1,0);

  ll t,now=1,pro=x;
  rep(i,1,n+1){
    now*=pro;
    now%=m;
    pro=now;

    if(ma.count(now)){
      t=i-ma[now];
      ll st=ma[now];
      ll ans=v[st-1];
      
      ans+=(v.back()-v[st-1])*((n-st+1)/t)+v[(n-st+1)%t+st-1]-v[st-1];

      cout<<ans<<ENDL;
      return 0;
    }

    v.eb(now);
    v.back()+=v[siz(v)-2];

    ma[now]=i;
  }
  cout<<v.back()<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 6732
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
pair<int, int> E[100001];
int H[100001];
int n[100001], kari[100001];
int sagasu(int A) {
	if (n[A] == n[A - 1]) return 0;
	if (n[A] == n[A - 1]) {
		return sagasu(E[H[A]].first) + 1;
	}
	int k = n[A - 1];
	for (int i = H[A]; i; i = E[i].second) {
		kari[k++] = sagasu(E[i].first);
	}
	sort(kari + n[A - 1], kari + n[A], greater<int>());
	int ret = 0;
	for (int i = 0; i < n[A] - n[A - 1]; i++) ret = max(ret, kari[n[A - 1] + i] + i);
	return ret + 1;
}

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


	int N = getint();

	for (int i = 2; i <= N; i++) {
		int a = getint();
		n[a]++;
		E[i] = mp(i, H[a]);
		H[a] = i;
	}
	rep1(i, N) n[i] = n[i - 1] + n[i];

	printf("%d\n", sagasu(1));

	Would you please return 0;
}

Measured memory_bytes: 8448
/*Anuranjan Srivastava (codersaty)*/
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define pinf INT_MIN
#define minf INT_MAX
#define loop(i,j) for(int i=1;i<=j;i++)
#define rep(i,j) for(int i=0;i<j;i++)
#define deb(x) cout<< #x << "=" << x<< endl
#define deb1(x,y) cout<< #x << "=" << x<<","<< #y << "=" << y<< endl
#define endl "\n"
#define F first
#define S second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define clr(x) memset(x,0,sizeof(x))
#define  sortall(x) sort(all(x))
#define  tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define  pii pair<int,int>
#define  pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pii>
#define vpl vector<pl>
#define  vvi vector<vi>
#define mi map<int,int>
#define ml map<ll,ll>
const double pi=3.141592653589793238;
using namespace std;


int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    cout<<((int)ceil((double)n /x))*t;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}
}

int main() {

	int t, x;
	cin >> t >> x;

	cout << fixed << setprecision(10) << (static_cast<double>(t) / static_cast<double>(x)) << 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 rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    long long N,K;
    cin>>N>>K;
    long long ans=0;
    ans=(N/K)*(N/K)*(N/K);
    long long p=0;
    if(2*N<K){
        cout << 0<< endl;
        return 0;
    }
    if(K%2==0){
        p=(2*N-K)/(2*K);
        p++;
    }
    ans=ans+(p*p*p);
    cout << ans << 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 FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    vector<ll> pows;
    vector<ll> av;
    ll k=0;
    while(1){
        ll t = k*k*k*k*k;
        if(t>INFL) break;
        av.push_back(k);
        pows.push_back(t);
        k++;
    }
    vector<ll> tv=pows;

    FOR(i, 1, k){
        av.push_back(-i);
        pows.push_back(-tv[i]);
    }
    sort(ALL(av));
    sort(ALL(pows));

    ll x; cin >> x;
    ll a, b;
    rep(i, pows.size()){
        a = pows[i];
        int t = lower_bound(ALL(pows), a-x) - pows.begin();
        b = pows[t];
        if(a-b==x){
            cout << av[i] << " " << av[t] << endl;
            break;
        }
    }
    return 0;}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W,K;
    cin >> H >> W >> K;
    vvec<char> F(H,vec<char>(W));
    for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin >> F[i][j];
    int ans = 0;
    for(int S=0;S<(1<<H);S++) for(int T=0;T<(1<<W);T++){
        int c = 0;
        for(int i=0;i<H;i++) for(int j=0;j<W;j++){
            if(S>>i&1) continue;
            if(T>>j&1) continue;
            if(F[i][j]=='#') c++;
        }
        ans += c==K;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3652
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		boolean ans = false;
		sc.close();
		for (int i = 1; i < 4; i++) {
			if (s.charAt(i) == s.charAt(i - 1)) {
				ans = true;
			}
		}
		System.out.println(!ans ? "Good" : "Bad");
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 23764
int main(void)
 {
  int a[10010];

  int i,n,m;
  scanf("%d%d",&n,&m);
  for(i=0; i<m; i++)
   scanf("%d",&a[i]);
  int s=0;
  for(i=0; i<m; i++) s+=a[i];
   if(s>n){
    printf("-1\n");}
   else{
     printf("%d\n",n-s);
    }
   return 0;
   }


Measured memory_bytes: 1744
#include <stdio.h>

int main(){
  int n,y;
  scanf("%d%d",&n,&y);
  int i,j;
  
  for(i=0;i<=n;++i){
    for(j=0;j<=(n-i);++j){
      int k = n-i-j;
      int sum = i*1000+j*5000+k*10000;
      if(sum == y){
        printf("%d %d %d\n",k,j,i);
        return 0;
      }
    }
  }
  puts("-1 -1 -1");
  return 0;
}


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

int main(){
    int N;
    std::cin >> N;
    
    std::vector< int > cnt(N+1, 0);
        for(int x=1; x<N; x++){
            for(int y=x; y<N; y++){
                for(int z=y; z<N; z++){
                    int index = x*x + y*y + z*z + x*y + y*z + z*x;
                    if(index > N){
                        break;
                    }
                    if(x == y && x == z){
                        cnt[index]++;
                    }else if(x == y || y == z || z == x){
                        cnt[index] += 3;
                    }else{
                        cnt[index] += 6;
                    }
                }
            }
        }
    for(int i=1; i<=N; i++){
        std::cout << cnt[i] << std::endl;
    }
    return 0;
}



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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 100009, mod = 1000000007;
int n;
string s;

int fact(int x) {
    int ret = 1;
    while(x) {
        ret = (ret*x)%mod;
        x--;
    }
    return ret;
}

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> s;

    vector<bool> left(2*n);
    left[0] = true;
    for(int i = 1; i < 2*n; ++i) {
        if(s[i] == s[i-1]) left[i] = !left[i-1];
        else left[i] = left[i-1];
    }

    int ans = 1;
    int lefts = 0, rights = 0;
    for(int i = 0; i < 2*n; ++i) {
        if(left[i]) {
            lefts++;
        } else {
            ans = (ans*(lefts-rights))%mod;
            rights++;
        }
    }

    if(rights != lefts || s[0] == 'W' || s[2*n-1] == 'W') ans = 0;
    else ans = (ans*fact(n))%mod;

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


Measured memory_bytes: 720
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int count=0;
		Scanner sc=new Scanner(System.in);
		String s;
		s=sc.nextLine();
		for(int i=1;i<s.length();i++) {
			if(s.charAt(i)!=s.charAt(i-1))count++;
		}
		System.out.println(count);
	}

}

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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;


int main() {
	int n, t;
	cin >> n >> t;
	VI v(n);
	REP(i, n)cin >> v[i];
	int a = v[0], b = 0;
	VI x;
	FOR(i, 1, n) {
		if (v[i] < a) {
			a = v[i];
		}
		else if (v[i] > b + a) {
			b = v[i] - a;
			x = {};
			x.push_back(a);
		}
		else if (v[i] - a == b) {
			x.push_back(a);
		}
	}
	int res = 1;
	REP(i, x.size() - 1) {
		if (x[i + 1] != x[i])res++;
	}
	cout << res << endl;


	return 0;
}

Measured memory_bytes: 1024
#define _overload(_1, _2, _3, _4, name, ...) name
#define _rep1(Itr, N) _rep3(Itr, 0, N, 1)
#define _rep2(Itr, a, b) _rep3(Itr, a, b, 1)
#define _rep3(Itr, a, b, step) for (i64 (Itr) = a; (Itr) < b; (Itr) += step)
#define repeat(...) _overload(__VA_ARGS__, _rep3, _rep2, _rep1)(__VA_ARGS__)

#include "bits/stdc++.h"
using i64 = long long;
using namespace std;

int main() {
    i64 n;
    cin >> n;
    vector<i64> p(n + 1);

    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j += i) {
            p[j]++;
        }
    }

    i64 ans = 0;
    for (int i = 1; i < n; i++) {
        ans += p[n - i];
    }

    cout << ans << endl;

    return 0;
};


Measured memory_bytes: 11080
#include <bits/stdc++.h>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


int main() {

    cpp_int  a, b;

    cin >> a >> b;

    cout << (a / b) << endl;

}



Measured memory_bytes: 3268
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define inf 1000000005
#define MOD 1000000007 
#define N 200005
#define M 1000003
#define LOG 20
#define KOK 250
#define EPS 0.0000001
using namespace std;

int i2[N],f[N],inv[N];

int mul(int x,int y) {
	
	return (ll)x*y%MOD;

}

int add(int x,int y) {

	x+=y;

	if(x>=MOD) x-=MOD;
	if(x<0) x+=MOD;

	return x;

}

int fe(int x,int y) {

	if(y==0) return 1;
	if(y&1) return mul(x,fe(x,y-1));

	int res=fe(x,y/2);

	return mul(res,res);	

}

int C(int x,int y) {

	return mul(f[x],mul(inv[y],inv[x-y]));

}

void up(int& pos,int amo,int oamo,int cur) {

	if(cur-1>=amo) {

		pos=add(pos,mul(i2[oamo+amo],C(amo+oamo-1,oamo)));
			
	}

}

int main() {

	int b,w;

	scanf("%d %d",&b,&w);

	i2[0]=f[0]=inv[0]=1;

	for(int i=1;i<=b+w;i++) {

		f[i]=mul(f[i-1],i);	
		inv[i]=fe(f[i],MOD-2);

	}

	for(int i=1;i<=b+w;i++) {

		i2[i]=mul(i2[i-1],inv[2]);

	}

	int pob=0,pow=0;

	for(int i=1;i<=b+w;i++) {

		up(pob,b,i-1-b,i);
		up(pow,w,i-1-w,i);

		int eq=add(1,-add(pob,pow));

		printf("%d\n",add(pow,mul(eq,inv[2])));

	}

}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
ll dp[3005][3005];
ll n,s;
ll a[3005];
const ll mod = 998244353;
ll qpow(ll a, ll b, ll m){
	if(b == 0)
		return 1;
	else if(b % 2 == 1)
		return a * qpow(a, b - 1, m) % m;
	else{
		ll num = qpow(a, b/2, m) % m;	
		return num * num % m;
	}
}
const ll inv2 = (mod+1) / 2;
int main(){
	cin>>n;
	cin>>s;
	for(ll i=1;i<=n;i++) cin>>a[i];
	
	dp[0][0] = qpow(2,n,mod);
	for(int i=1;i<=n;i++){
		for(int j=0;j<=s;j++){
			(dp[i][j] += dp[i-1][j]) %= mod;
			if(j>=a[i]) {
				(dp[i][j] += dp[i-1][j-a[i]] * inv2) %= mod;
			}
		}
	}
	cout<<dp[n][s]%mod<<endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    string suffix = "";

    switch (n % 10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
        suffix = "hon";
        break;
    
        case 0:
        case 1:
        case 6:
        case 8:
        suffix = "pon";
        break;

        default:
        suffix = "bon";
    }

    cout << suffix << endl;
    return 0;
}



Measured memory_bytes: 3596
#include <stdio.h>
int main(){
  int r, g, b;
  scanf("%d %d %d", &r, &g, &b);
  if( (r*100 + g*10 + b) % 4 ){ printf("NO\n");  }
  else						  { printf("YES\n"); }
  return 0;
}

Measured memory_bytes: 1644
import numpy as np
n, w = map(int, input().split())
v_max = 1000
num_v = v_max*n
INF = 10**9+1
dp = np.full(num_v+1, INF, dtype=int)
dp[0] = 0
for i in range(1,n+1):
  wn, vn = map(int, input().split())
  dp[vn:] = np.minimum(dp[vn:], dp[:-vn]+wn)
for i in range(len(dp)-1, -1, -1):
  if dp[i] <= w:
    print(i)
    break

Measured memory_bytes: 14884
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mes(a,b) memset(a,b,sizeof(a))
#define sbs(i,j) substr(i,j)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);

string a[55];
string b[55];
int main(){
    std::ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    rep(i,0,n-1)
        cin>>a[i];
    rep(i,0,m-1)
        cin>>b[i];
    int flag=false;
    rep(i,0,n-1){//枚举行
        rep(j,0,n-1){//枚举列
            if(i+m-1>=n||j+m-1>=n) continue;
            int f=true;
            rep(k,0,m-1){
                rep(o,0,m-1){
                    if(a[i+k][j+o]!=b[k][o])
                        f=false;
                }
            }
            if(f) flag=true;
        }
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

#define REP(i, n, N) for(double i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int ans=0,N;
    cin >> N;
    REP(i,1,50001){
        if((int)(i*1.08)==N){
            ans=i;
            break;   
        }
    }
    if(ans){
        P(ans);
    }else{
        P(":(");
    }
}

Measured memory_bytes: 256
#include "stdio.h"

int main()
{
    long long a,b,n,m;
    scanf("%lld %lld",&a,&b);
    n=a*2+b;
    m=n/4;
    if(m>b/2)
        m=b/2;
    printf("%lld\n",m);
    return 0;
}


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

int main(){
  int alpha[26] = {0};
  char ch;

  //???????????\???
  while(cin >> ch){
    ch = tolower(ch);
    //if(ch == '.') break;
    if(isalpha(ch)){
      int index = ch - 'a';
      alpha[index]++;
    }
  }

  //??????
  for(int i =0; i<26; i++){
    cout << (char)('a' + i) << " : " << alpha[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 3084
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
a = [i() for _ in range(N)]
now = 1
ans = 1
for i in range(N):
    if a[now-1] == 2:
        print(ans)
        exit()
    now = a[now-1]
    ans += 1
print(-1)

Measured memory_bytes: 85108
s=input()
t=input()

n=len(s)
s_d={}
t_d={}
s_n=[]
t_n=[]
s_cnt=1
t_cnt=1

for s_i, t_i in zip(s,t):

    if s_i in s_d:
        s_n.append(s_d[s_i])
    else:
        s_d[s_i]=s_cnt
        s_cnt+=1
        s_n.append(s_d[s_i])

    if t_i in t_d:
        t_n.append(t_d[t_i])
    else:
        t_d[t_i]=t_cnt
        t_cnt+=1
        t_n.append(t_d[t_i])

print('Yes' if s_n==t_n else 'No')


Measured memory_bytes: 6716
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000

int main()
{
    ll n, x, y;
    cin >> n >> x >> y;
    vector<vector<ll>> work(n);
    rep(i, n) {
        work[i].resize(n);
        rep(j, n) {
            work[i][j] = INF;
        }
    }
    rep(i, x) {
        rrep(j, i + 1, y) {
            work[i][j] = min(work[i][j], j - i);
        }
        rrep(j, x, y) {
            work[i][j] = min(work[i][j], x + y - i - j - 1);
        }
        rrep(j, y, n) {
            work[i][j] = min(work[i][j], j - i - (y - x - 1));
        }
    }
    rrep(i, x, y) {
        rrep(j, i + 1, n) {
            work[i][j] = min(work[i][j], j - i);
        }
        rrep(j, i + 1, y) {
            work[i][j] = min(work[i][j], i - (x - 1) + (y - 1) - j + 1);
        }
        rrep(j, y, n) {
            work[i][j] = min(work[i][j], i - (x - 1) + j - (y - 1) + 1);
        }
    }
    rrep(i, y, n) {
        rrep(j, i + 1, n) {
            work[i][j] = min(work[i][j], j - i);
        }
    }
    vector<ll> result(n, 0);
    rep(i, n) {
        rrep(j, i + 1, n) {
            if (work[i][j] < INF) {
                ++result[work[i][j]];
            }
        }
    }
    rrep(i, 1, n) {
        printf("%lld\n", result[i]);
    }
    return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  //外枠上
  for (int i = 0; i< (W + 2); i++){
    cout << "#";
  }
  cout << endl;
  
  for (int k = 0; k < H; k++){
    cout << "#";
    string pixel;
    cin >> pixel;
    
    for (int l = 0; l < W; l++){
      cout << pixel.at(l);
    }
    
    cout << "#" << endl;
  }
  
  //外枠下
  for (int i = 0; i< (W + 2); i++){
    cout << "#";
  }
  cout << endl;
  
}



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

using namespace std;

int main() {
	vector<int> a(12);
	for (int i = 0; i < 12; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	if ((a[0] == a[1] && a[0] == a[2] && a[0] == a[3]) && (a[4] == a[5] && a[4] == a[6] && a[4] == a[7]) && (a[8] == a[9] && a[8] == a[10] && a[8] == a[11])) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}
	return 0;
}

Measured memory_bytes: 3144
import queue
q=queue.Queue()
n,m=map(int,input().split())
room=[]
singpost=[0]*(n+1)
 
for i in range(n+1):
    room.append([])
 
for _ in range(m):
    r1,r2=map(int,input().split())
    if r1==1 :
        singpost[r2]=1
        q.put(r2)
    elif r2==1:
        singpost[r1]=1
        q.put(r1)
    else:
        room[r1].append(r2)
        room[r2].append(r1)
 
while not(q.empty()):
    loca=q.get()
    for x in room[loca]:
        if singpost[x]==0:
            singpost[x]=loca
            q.put(x)
 
if singpost.count(0)>2:print("No")
else:
    print("Yes")
    for x in range(2,n+1):
        print(singpost[x])

Measured memory_bytes: 34372
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;

const int MAXN=1e5+5;

int n,m,ans;
int a[MAXN],b[MAXN];

int main(){
    scanf("%d",&n); m=n/2;
    for(int i=1;i<=n;i++){
        if(i&1) scanf("%d",&a[(i+1)/2]);
        else scanf("%d",&b[(i+1)/2]);
    }
    sort(a+1,a+m+1);
    sort(b+1,b+m+1);
    int c1,s1=0,s2=0,now=0;
    for(int i=1;i<=m;i++){
        if(a[i]!=a[i-1]) now=0;
        now++;
        if(now>s1) s1=now,c1=a[i];
    }
    now=0;
    for(int i=1;i<=m;i++){
        if(a[i]==c1) continue;
        if(a[i]!=a[i-1]) now=0;
        now++;
        if(now>s2) s2=now;
    }
    int c2,p1=0,p2=0; now=0;
    for(int i=1;i<=m;i++){
        if(b[i]!=b[i-1]) now=0;
        now++;
        if(now>p1) p1=now,c2=b[i];
    }
    now=0;
    for(int i=1;i<=m;i++){
        if(b[i]==c2) continue;
        if(b[i]!=b[i-1]) now=0;
        now++;
        if(now>p2) p2=now;
    }
    if(c1!=c2) printf("%d",n-p1-s1);
    else{
        int res=0;
        res=max(p1+s2,res);
        res=max(p2+s1,res);
        printf("%d",n-res);
    }
}


Measured memory_bytes: 512
import sys
from collections import deque

read = sys.stdin.read

H, W = map(int, input().split())
S = tuple(map(str, read().split()))
udlr = ((1, 0), (-1, 0), (0, 1), (0, -1))

visited = [[False] * W for i in range(H)]
answer = 0
for i in range(H):
    for j in range(W):
        if visited[i][j] or S[i][j] == '.':
            continue

        visited[i][j] = True
        queue = deque([(i, j)])
        black = 1
        white = 0

        while queue:
            x, y = queue.popleft()
            if S[x][y] == '#':
                switch = 'Black'
            else:
                switch = 'White'

            for di, dj in udlr:
                new_i = x + di
                new_j = y + dj
                if 0 <= new_i < H and 0 <= new_j < W:
                    if visited[new_i][new_j]:
                        continue

                    if switch == 'Black':
                        if S[new_i][new_j] == '.':
                            white += 1
                            queue.append((new_i, new_j))
                            visited[new_i][new_j] = True
                    else:
                        if S[new_i][new_j] == '#':
                            black += 1
                            queue.append((new_i, new_j))
                            visited[new_i][new_j] = True
        answer += black * white

print(answer)


Measured memory_bytes: 4900
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
using namespace std;
int main(){
    int n;
    cin>>n;
    if (n==1) {
      cout<<"Hello World"<<endl;
      return 0;
    }else{
      int a,b;
      cin>>a>>b;
      cout<<(a+b)<<endl;
      return 0;
    }
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    vector<int> dp(n);
    dp[0] = 0;

    for(int i=1; i<n; i++){
        int kk =0;
        if(i-k > 0){
            kk = i-k;
        }
        for(int j=kk; j<i; j++){
            if(j==kk){
                dp[i] = dp[j] + abs(h[i] - h[j]);
            }else{
                dp[i] = min(dp[j] + abs(h[i] - h[j]), dp[i]);
            }
        }
    }

    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
  string s;
  cin >> s;
  int c[30] = {0};
  int a = 'a';
  int z = s.size();
  bool ok = true;
  for (int i = 0; i < z; i++) {
    int p = s[i] - a;
    c[p]++;
    if (c[p] > 1) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
  return 0;
}


Measured memory_bytes: 3032
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<cmath>
#include<set>
#include<stack>
#include<climits>

using namespace std;
typedef unsigned long long ll;

int main(){
    double C=1;
    for(int i=1;i<=9;i++){
        C*=i;
    }
    int n;
    int a[9];
    int b[9];
    cin>>n;
    while(n--){
        for(int i=0;i<9;i++){
            cin>>a[i];
        }
        for(int i=0;i<9;i++){
            cin>>b[i];
        }
        sort (a,a+9);
        sort (b,b+9);
        double ans1=0,ans2=0;
        do {
                int sc1=0,sc2=0;
                for(int i=0;i<9;i++){
                    if(a[i]>b[i]){
                        sc1+=a[i]+b[i];
                    } else {
                        sc2+=a[i]+b[i];
                    }
                }
                if(sc1>sc2){
                    ans1++;
                } else {
                    ans2++;
                }
        } while ( next_permutation(a,a+9) );
        double tot=ans1+ans2;
        ans1/=tot;
        ans2/=tot;
        cout<<ans1<<" "<<ans2<<endl;
        
    }
    
    return 0;
}

Measured memory_bytes: 1252
a, b = map(int, input().split())
x1 = a + b
x2 = a - b
x3 = a * b

if x1 >= x2 and x1 >= x3:
    print(x1)
elif x2 >= x1 and x2 >=x3:
    print(x2)
elif x3 >= x1 and x3 >= x2:
    print(x3)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
const double eps=1e-8;
inline int sign(double x){return (x>eps)-(x<-eps);}
const int maxn=3e5+10,mod=1e9+7,INF=0x3f3f3f3f;
ll a[maxn];
char s[maxn];
ll bs[100];
void insert(ll x)
{
    for (int i=62;i>=0;--i)
    {
        if (x&(1ll<<i))
        {
            if (!bs[i])
            {
                bs[i]=x;
                return;
            }
            x^=bs[i];
        }
    }
}
inline bool check(ll x)
{
    for (int i=62;i>=0;--i)
        if (x&(1ll<<i))
            x^=bs[i];
    return x==0;
}
int main()
{
	int T;
	cin>>T;
	while (T--){
		memset(bs,0,sizeof(bs));
		int n;
		scanf("%d",&n);
		for (int i=1;i<=n;++i)
			scanf("%lld",&a[i]);
		scanf("%s",s+1);
		int ans=0;
		for (int i=n;i;--i){
			if (s[i]=='0')
				insert(a[i]);
			else{
				if (!check(a[i]))
					ans=1;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 3720
#include <stdio.h>
int main()
{
	int i, d, n;
	scanf("%d %d", &d, &n);
	int xixi = 1;
	for(i = 1 ; i <= d ;i++)
	{
		xixi = xixi * 100;
	}
	if(n <= 99)printf("%d\n", xixi * n);
	else printf("%d\n", 101 * xixi);
	return 0;
}

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

int main(){
    string str, t = "()[]";
    while(getline(cin,str) && str != "."){
        stack<char> s;
        bool judge = true;
        for(char x : str){
            if(!count(t.begin(), t.end(), x))    continue;

            if(s.empty() || x == '(' || x == '['){
                s.push(x);
            }else if(!s.empty() && (x == ')' && s.top() == '(') || (x == ']' && s.top() == '[')){
                s.pop();
            }else{
                judge = false;
                break;
            }
        }
        
        if(s.empty() && judge)  cout << "yes" << endl;
        else                    cout << "no" << endl;
    }
    return 0;
}


Measured memory_bytes: 3144
package main

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

func main() {
	Length := readInt()
	S, T := strings.Split(readString(), ""), strings.Split(readString(), "")

	Loop(0, Length, func(i int) {
		fmt.Print(S[i])
		fmt.Print(T[i])
	})

	fmt.Println()
}

/////////////////////////////////////////
var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Split(bufio.ScanWords)
	//scanner.Split(bufio.ScanLines)
}

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	return t
}

func Loop(start, end int, f func(i int)) {
	for i := start; i < end; i++ {
		f(i)
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int ketawa(int n){
  int sum = 0;
  while(n>0){
    sum+=n%10;
    n/=10;
  }
  return sum;
}
int main() {
  int n;
  cin>>n;
  Yes(n%ketawa(n)==0);

  return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

//constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

  int a, b, c;
  cin >> a >> b >> c;

  cout << c << " " << a << " " << b << endl;
  return 0;
}

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

#define PI acos(-1.0)
#define INF 2e9
#define INFLL 9e18
#define EPS 1e-9
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int a[1000000],b[1000000];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(2);
    cout << fixed;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);


    ll t,a,b,c,d,n,m,i,j,x,y,k,mx,mn,res=0,cnt=0;
    cin >> n >> d;
    for(i=0;i<n;i++){
        cin >> x >> y ;
        x*=x;
        y*=y;
        double k=sqrt(x+y);
        if(k<=d) cnt++;
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3708
N=int(input())
res={'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for i in range(N):
	c=input()
	res[c]+=1

print('AC x',res['AC'])
print('WA x',res['WA'])
print('TLE x',res['TLE'])
print('RE x',res['RE'])

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

int t[100005],a[100005];

int main() {
  int n,u,v;
  cin>>n>>u>>v;
  u--; v--;
  vector<int> g[100005];
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  rep(i,n){
    t[i]=-1; a[i]=-1;
  }
  t[u]=0; a[v]=0;
  queue<int> q;
  q.push(v);
  while(q.size()){
    int v1=q.front(); q.pop();
    for(int v2: g[v1]){
      if(a[v2]!=-1) continue;
      a[v2]=a[v1]+1;
      q.push(v2);
    }
  }
  q.push(u);
  while(q.size()){
    int v1=q.front(); q.pop();
    for(int v2: g[v1]){
      if(t[v2]!=-1) continue;
      t[v2]=t[v1]+1;
      q.push(v2);
    }
  }
  int ans=0;
  rep(i,n){
    if(a[i]<=t[i]) continue;
    ans=max(ans,a[i]-1);
  }
  cout<<ans<<endl;
  return 0;
}



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

using namespace std;
using ll = long long;

const long long MOD = 1000000007;
int main() {
    ll N = 0;
    cin >> N;
    ll K = 0;
    cin >> K;
    ll countp = 0, countz = 0, countn = 0;
    vector<ll> A(N,0);
    for(ll i = 0; i < N; i++) {
    cin >> A.at(i);
    if (A.at(i) > 0)countp++;//正の個数を数える
    else if (A.at(i) == 0)countz++;//0の個数
    else countn++;//負の個数
    }

    sort(A.begin(),A.end());
    ll ans = 1;
    ll getp;//とった正の数の個数
    ll getn;//負Version
    
    if ((countp + countz == 0)&&((K-1)%2))//全部が負で偶数個選ぶ時
    {
        //cout << 1 << endl;
        for (size_t i = 0; i < K; i++)
        {
            
            ans = ((ans*A.at(i)%MOD)+MOD)%MOD;
        }
        cout << ans << endl;
        return 0;
    }else if ((countp + countz == 0)&&(K%2))//全部が負で奇数個選ぶ時
    {
        //cout << 1 << endl;
        for (size_t i = 0; i < K; i++)
        {
            
            ans = ((ans*A.at(N-1-i)%MOD)+MOD)%MOD;
        }
        cout << ans << endl;
        return 0;//処理は終了してるので下の処理を行ってしまわないように強制終了
    }
    

    if (K%2)//奇数個選ぶ時
    {
        getn = 0;
        getp = 0;
        ans = A.at(N-1);//奇数個選び取り，後に2つセットで選ぶつもりなので選ぶ必要のある残りの個数を偶数子にするために一つは大きい方から一個選び取っている
        for (size_t i = 0; i < K-1; i += 2)
        {
            if (A.at(N-2-getp)*A.at(N-3-getp) >= A.at(getn)*A.at(getn+1))
            {//ソートの大きい方から2つと小さい方から2つの積を比べて大きい方を解に掛ける
                ans = ((ans*A.at(N-2-getp)%MOD)+MOD)%MOD;
                ans = ((ans*A.at(N-3-getp)%MOD)+MOD)%MOD;
                getp += 2;//大きい方から2つ選んだことを示す
            }
            else
            {
                ans = ((ans*A.at(getn)%MOD)+MOD)%MOD;
                ans = ((ans*A.at(1+getn)%MOD)+MOD)%MOD;
                getn += 2;//小さい方から2つ選んだことを示す
            }
            
        }
        cout << ans << endl;
        
        
    }else//偶数個選ぶ時
    {
        getn = 0;
        getp = 0;
        for (size_t i = 0; i < K; i += 2)
        {
            //cout << ans << endl;
            if (A.at(N-2-getp)*A.at(N-1-getp) >= A.at(getn)*A.at(getn+1))
            {
                ans = ((ans*A.at(N-2-getp)%MOD)+MOD)%MOD;
                ans = ((ans*A.at(N-1-getp)%MOD)+MOD)%MOD;
                getp += 2;
            }
            else
            {
                ans = ((ans*A.at(getn)%MOD)+MOD)%MOD;
                //cout << ans << endl;
                //cout << ans*A.at(1+getn) << endl;
                ans = ((ans*A.at(1+getn)%MOD)+MOD)%MOD;
                getn += 2;
            }
            
        }
        cout << ans << endl;
    }
    
    



    return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int k,n;
	cin>>k>>n;
	vector<int>a(n);
	for(auto&i:a)cin>>i;
	int mx=0;
	for(int i=1;i<n;++i){
		mx=max(mx,a.at(i)-a.at(i-1));
	}
	mx=max(mx,k-a.back()+a.at(0));
	cout<<k-mx<<"\n"s;
}

Measured memory_bytes: 1024
import heapq
N , M = map(int, input().rstrip().split())
 
pricelist = list(map(int, input().split()))
for i in range(N):
  pricelist[i] = pricelist[i] * (-1)
heapq.heapify(pricelist)

 
for i in range(M):
  minprice = heapq.heappop(pricelist)
  if minprice % 2 == 0:
    minprice = minprice // 2
  else:
    minprice = minprice // 2 + 1
  heapq.heappush(pricelist, minprice)

print(sum(pricelist)* (-1)) 

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

int main(){
  int n;
  cin >> n;
  bool open[100][10];
  rep(i, n){
    rep(j, 10){
      int f;
      cin >> f;
      open[i][j] = f;
    }
  }
  int p[100][11];
  rep(i, n){
    rep(j, 11){
      cin >> p[i][j];
    }
  }
  int ans;
  for(int i = 1; i < (1 << 10); i++){
    bitset<10> s(i);
    int cnt[100];
    fill(cnt, cnt + 100, 0);
    for(int j = 0; j < 10; j++){
      if(s.test(j)){
        for(int k = 0; k < n; k++){
          if(open[k][j]) cnt[k]++;
        }
      }
    }
    int tmp = 0;
    for(int j = 0; j < n; j++){
      tmp += p[j][cnt[j]];
    }
    if(i == 1) ans = tmp;
    else ans = max(ans, tmp);
  }
  cout << ans <<endl;
      
}

Measured memory_bytes: 3616
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int H, W; cin >> H >> W;
  string a[H]; rep(i,H) cin >> a[i];

  bool h[H]; fill_n(h, H, true);
  bool w[W]; fill_n(w, W, true);

  rep(i, H) {
    bool ok = true;
    rep(j, W) if (a[i][j]=='#') ok = false;
    if (ok) h[i] = false;
  }
  rep(i, W) {
    bool ok = true;
    rep(j, H) if (a[j][i]=='#') ok = false;
    if (ok) w[i] = false;
  }

  rep(i, H) {
    if (h[i]) {
      rep(j, W) if (w[j]) cout << a[i][j];
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val sp = readLine()!!.split(" ")

    val n = sp[0].toLong()
    val x = sp[1].toInt()
    val m = sp[2].toInt()


    val first = Array(m) { -1 }
    val sums = Array(m + 1) { 0L }

    var step = 0
    first[x] = step

    var a = x.toLong()
    val period: Int
    val start: Int
    while (true) {
        step++
        sums[step] = (sums[step - 1] + a)
        a = (a * a) % m
        val prev = first[a.toInt()]
        if (prev == -1) first[a.toInt()] = step
        else {
            period = step - prev
            start = prev
            break
        }
    }

    if (n < start) println(sums[n.toInt()])
    else {
        var res = sums[start]
        res += (sums[start + period] - sums[start]) * ((n - start) / period)
        val rest = ((n - start) % period).toInt()
        res +=  sums[start + rest] - sums[start]

        println(res)
    }
}

Measured memory_bytes: 38996
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N , K , x;
  cin >> N >> K;
  int kyori = 0;
  
  for(int i = 0; i < N; i++){
    cin >> x;
    if(x * 2 < (K - x) * 2){
      kyori += x * 2;
    }else{
      kyori += (K - x) * 2;
     }
  }
  cout << kyori << endl;
}

Measured memory_bytes: 3636