akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vi odd(100010),even(100010);
    rep(i,n){
        int v; cin>>v;
        if (i%2==0) even[v]++;
        else odd[v]++;
    }
    int om=0, em=0;
    int oi=-1, ei=-1;
    rep(i,100010){
        if (om<odd[i]){
            om = odd[i];
            oi = i;
        }
        if (em<even[i]){
            em = even[i];
            ei = i;
        }
    }
    sort(rall(odd));
    sort(rall(even));
    if (ei==oi){
        cout<<min((n/2-odd[0])+((n+1)/2-even[1]), (n/2-odd[1])+((n+1)/2-even[0]))<<endl;
    }else{
        cout<<(n/2-odd[0])+((n+1)/2-even[0])<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<ll> a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        string s;
        cin >> s;
        set<ll> dp;
        bool ans = false;
        for (int i = n - 1; i >= 0; i--) {
            if (s[i] == '0') {
                for (ll e : dp) {
                    a[i] = min(a[i], a[i] ^ e);
                }
                set<ll> ndp;
                for (ll e : dp) {
                    ndp.emplace(min(e, e ^ a[i]));
                }
                dp = ndp;
                dp.emplace(a[i]);
            } else {
                for (ll e : dp) {
                    a[i] = min(a[i], a[i] ^ e);
                }
                if (a[i]) {
                    ans = true;
                    break;
                }
            }
        }
        cout << ans << '\n';
    }
    return 0;
}


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

int main()
{
	int n;
	cin>>n;
	int ans=0;
	if(n<105) cout<<"0"<<endl;
	else{
		for(int i=105;i<=n;i+=2){
			int sum=0;
			for(int j=1;j<=i;j++){
				if(i%j==0) sum++;
			}
			if(sum==8) ans++;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	int d;
	scanf("%d%d",&n,&d);
	int m;
	m=n%(d*2+1);
	int q;
	q=n/(d*2+1);
	if(m!=0){
		
		printf("%d\n",q+1);
		
	}
	else{
		printf("%d\n",q);
	}
	
	return 0;
 } 

Measured memory_bytes: 256
#include<stdio.h>
int f(int n,int i){
	n*=i;
	return n*n;
}
int main(){
	int n,i,a=0;
	for(;scanf("%d",&n)!=EOF;a=0){
		for(i=0;n*i<600;i++)a+=f(n,i)*n;
		printf("%d\n",a);
	}
	exit(0);
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N,M;
	int x[100010]={};
	int y[100010]={};
	
	cin >> N >> M;
	for(int i=0;i<M;i++)
	{
		cin >> x[i] >> y[i];
		x[i]--;
		y[i]--;
	} 
	
	int sum[100010]={};
	bool pos[100010]={};
	for(int i=0;i<N;i++)
		sum[i]=1;
	pos[0]=true;
	
	for(int i=0;i<M;i++)
	{
		if(sum[x[i]]==0)
			continue;
		
		if(pos[x[i]])
			pos[y[i]]=true;
		if(sum[x[i]]==1)
			pos[x[i]]=false;
		sum[x[i]]--;
		sum[y[i]]++;
	}
	
	int ans=0;
	for(int i=0;i<N;i++)
		if(pos[i])
			ans++;
		
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1536
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    int ans=0;
    int n;
    cin>>n;

    vector<int> d;

    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        d.push_back(a);
    }

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans+=d[i]*d[j];
        }
    }


    cout<<ans<<endl;

    return 0;
}


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


int main(){

 int H1,H2;
 int M1,M2;
 cin>>H1>>M1>>H2>>M2;
 int K;
 cin>>K;

 int Caini,Cafin,Res;

 Caini = (H1*60) + M1;
 Cafin = (H2*60) + M2;

 //cout<<Caini<<" "<<Cafin<<"\n";

 Res=Cafin-Caini-K;

 cout<<Res;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int x = 0, y = 0, z = 0;
    REP(i, n){
        int p;
        cin >> p;
        if(p <= a){
            x++;
        }else if(p <= b){
            y++;
        }else{
            z++;
        }
    }
    cout << min({x, y, z}) << endl;
    return 0;
}

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

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"

#define sqr(a) ((a) * (a))
#define jor(a) !(a&1)// jor means EVEN number
#define bjor(a) (a&1)// bjor means ODD number

#define all(a)  a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr)) //memset only for -1 and 0
//fill(a, a+n, 5) //fill for any value

#define for0(i,b) for(int i=0;i<(b);i++)
#define for1(i,b) for(int i=1;i<=(b);i++)
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define forba(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fileRead freopen("input.txt", "r", stdin);

void print(int a[], int n){ // for testing or debugging
    for(int i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
}

//______________________________________________________\\


int main()
{
    IOS;
    //fileRead
    int t = 1;
    //cin>>t;
    while(t--)
    {
    	int n; cin>>n;
    	vi dp(3);
    	for0(a,n){
    		vi newdp(3), c(3);
    		for0(k,3) cin>>c[k];
    		
    		for0(i,3){
    			for0(j,3){
    				if(i!=j) newdp[j]=max(newdp[j], dp[i]+c[j]);
    			}
    		}
    		dp=newdp;
    	}
    	cout<<max({dp[0], dp[1], dp[2]});
	}
}
//for(auto t: )cout<<t<<" "; cout<<endl;


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2000005;
int n,m,cnt,p[12]={1},ans[N];
char s[N];
struct tree
{
	int ch[3],id,tag;
}a[N];
void build(int d,int x,int v)
{
	a[x].tag=0;
	if(d==n)
	{
		a[x].id=v;
		return;
	}
	for(int i=0;i<3;i++)
	{
		a[x].ch[i]=++cnt;
		build(d+1,a[x].ch[i],v+p[d]*i);
	}
}
void pushdown(int x)
{
	if(a[x].tag)
	{
		for(int i=0;i<3;i++)
		{
			swap(a[a[x].ch[i]].ch[1],a[a[x].ch[i]].ch[2]);
			a[a[x].ch[i]].tag^=1;
		}
		a[x].tag=0;
	}
}
void add(int d,int x)
{
	if(d==n)
		return;
	pushdown(x);
	int b[3];
	for(int i=0;i<3;i++)
		b[i]=a[x].ch[i];
	for(int i=0;i<3;i++)
		a[x].ch[i]=b[(i+2)%3];
	add(d+1,a[x].ch[0]);
}
void out(int d,int x,int v)
{
	if(d==n)
	{
		ans[a[x].id]=v;
		return;
	}
	pushdown(x);
	for(int i=0;i<3;i++)
		out(d+1,a[x].ch[i],v+p[d]*i);
}
int main()
{
	scanf("%d%s",&n,s+1);
	m=strlen(s+1);
	for(int i=1;i<=n;i++)
		p[i]=p[i-1]*3;
	build(0,0,0);
	for(int i=1;i<=m;i++)
	{
		if(s[i]=='S')
		{
			swap(a[0].ch[1],a[0].ch[2]);
			a[0].tag^=1;
		}
		if(s[i]=='R')
			add(0,0);
	}
	out(0,0,0);
	for(int i=0;i<p[n];i++)
		printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 21876
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int N = 3001, M = N;
//=======================

vi g[N];
int dp[N][N][2];

void solve() {
	int i, j, n, m;
	cin >> n;
	int a[n];
	fo(i, n) cin >> a[i];
	int prefix[n];
	fo(i, n) {
		prefix[i] = a[i];
		if (i) prefix[i] += prefix[i - 1];
	}
	//y=(prefix[j]-prefix[i-x]);
	//dp[i][j][p]=max(a[i]+(y-dp[i+1][j][p^]),a[j]+(y-dp[i][j-1][p^]))
	int len = 0;
	fo(i, n + 1) {
		dp[i][i][0] = a[i];
		dp[i][i][1] = a[i];
	}
	Fo(len, 1, n + 1) {
		for (int i = 0; i + len < n; i++) {
			j = i + len;
			int y = prefix[j];
			y += (i - 1 >= 0) ? -prefix[i - 1] : 0;
			// deb2(i, j); deb(y);
			dp[i][j][0] = max((y - dp[i + 1][j][1]), (y - dp[i][j - 1][1]));
			dp[i][j][1] = max((y - dp[i + 1][j][0]), (y - dp[i][j - 1][0]));
			// deb2(dp[i][j][0], dp[i][j][1]);
		}
	}
	cout << 2 * dp[0][n - 1][0] - prefix[n - 1] << "\n";
}

int32_t main()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
	return 0;
}

void ipgraph(int n, int m) {
	int i, u, v;
	while (m--) {
		cin >> u >> v;
		u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par) {
	for (int v : g[u]) {
		if (v == par) continue;
		dfs(v, u);
	}
}

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

long long gcd(long long a, long long b) { return b?gcd(b,a%b):a;}

int main(){
    int N;
    cin >> N;
    long long dp[N+1][2];
    for(int i=0;i<N+1;i++){
        for(int j=0;j<2;j++){
            dp[i][j]=0;
        }
    }
    vector<long long> numbers(N);
    for(int i=0;i<N;i++){
        long long a;
        cin >> a;
        numbers[i] = a;
    }
    sort(numbers.begin(),numbers.end());
    int maxNum = numbers[N-1];
    for(int i=0;i<N;i++){
        if(i==N-1){
            dp[i+1][1] = max(dp[i][0],gcd(dp[i][1],numbers[i]));
            continue;
        }
        if(i==0){
            dp[i+1][0] = numbers[0];
            dp[i+1][1] = maxNum;
            continue;
        }
            dp[i+1][0] = gcd(dp[i][0],numbers[i]);
            dp[i+1][1] = max(gcd(dp[i][1],numbers[i]),gcd(dp[i][0],maxNum));
            // cerr<<dp[i+1][0] << endl;
            // cerr<<dp[i+1][1] << endl;
    }
    cout << dp[N][1] << endl;

}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int black_count( vector<vector<char>> &v,int h,int w){
	int ret = 0;
	v[h][w] = '#';
	if(v[h+1][w] == '.')ret += black_count(v,h+1,w)+1;
	if(v[h-1][w] == '.')ret += black_count(v,h-1,w)+1;
	if(v[h][w+1] == '.')ret += black_count(v,h,w+1)+1;
	if(v[h][w-1] == '.')ret += black_count(v,h,w-1)+1;
	
	return ret;
}
		
	
int main()
{
	int w,h,startw,starth;
	while(1){
		cin >> w >> h;
		
		
		if(w == 0 && h == 0)break;
		vector<vector<char>> v(h+2,vector<char>(w+2,'#'));
		
		for(int i=1;i<h+1;i++){
			for(int j=1;j<w+1;j++){
				cin >> v[i][j];
				if(v[i][j] == '@'){
					starth = i;
					startw = j;
				}
			}
		}
		
		cout << black_count(v,starth,startw)+1 << endl;
		
		
	}
	return 0;
}


Measured memory_bytes: 3052
#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;
const int INF = 1e9;

int main()
{
    int n; cin >> n;
    map<string, int> mp;
    rep(i,n) {
        string s;
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for (auto p : mp) mx = max(mx, p.second);
    for (auto p : mp) {
        if (p.second != mx) continue;
        cout << p.first << endl;
    }

    return 0;
}

Measured memory_bytes: 25216
k = gets.to_i

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

puts a[k-1]

Measured memory_bytes: 1788
import java.util.Scanner;
 
 
public class Main{
     
    public static void main(String[] args){
    	
    	final Scanner sc = new Scanner(System.in);
    	
    	long n = sc.nextLong();
    	int count = 0;
    	
    	while(n > 1){
    		n  = (n + (n % 3 == 0 ? 0 : 3 - n % 3)) / 3;
    		count++;
    	}
    	
    	System.out.println(count);
    	
    }
     
}

Measured memory_bytes: 12000
N, L = map(int, input().split())
taste = []
for i in range(N):
    taste.append(L + i + 1 - 1)

a = sum(taste)
tmp = abs(a - (a - taste[0]))
ans = a - taste[0]
for i in range(N - 1):
    if abs(a - (a - taste[i + 1])) < tmp:
        tmp = abs(a - (a - taste[i + 1]))
        ans = a - taste[i + 1]
print(ans)

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

struct Process
 {
   char name[100];
   int t;
 };

struct Process Q[1000];

int seisuu;

void enqueue(struct Process x)
{
  int i;

  for(i=1;i<seisuu;i++) Q[i]=Q[i+1];

  Q[seisuu]=x;
}

struct Process dequeue(){ seisuu--;}

int main(){
  int i,q,time=0;
  scanf("%d %d",&seisuu,&q);
  for (i=1;i<=seisuu;i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  while(1){
    if(seisuu==0)break;
    if(Q[1].t>q){
      time+=q;
      Q[1].t-=q;
      enqueue(Q[1]);
    }
    else if(Q[1].t<=q){
      time+=Q[1].t;
      printf("%s %d\n",Q[1].name,time);
      enqueue(Q[1]);
      dequeue();
    }
  }
  return 0;
}

Measured memory_bytes: 520
#include <bits/stdc++.h>
 
using namespace std;
 
#define f0r(a, b) for (long long a = 0; a < (b); a++)
#define f1r(a, b, c) for (long long a = (b); a < (c); a++)
#define f0rd(a, b) for (long long a = (b); a >= 0; a--)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define pb push_back
#define mp make_pair
#define f first
#define s second
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
 
void fio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
}
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const long double pi = 3.14159265358979323846;
const ll mod = 1e9 + 7;

namespace modop {
	ll madd(ll a, ll b) {
	  return (a + b) % mod;
	}
	ll msub(ll a, ll b) {
	  return (((a - b) % mod) + mod) % mod;
	}
	ll mmul(ll a, ll b) {
	  return ((a % mod) * (b % mod)) % mod;
	}
	ll mpow(ll base, ll exp) {
	  ll res = 1;
	  while (exp) {
		if (exp % 2 == 1){
			res = (res * base) % mod;
		}
		exp >>= 1;
		base = (base * base) % mod;
	  }
	  return res;
	}
	ll minv(ll base) {
	  return mpow(base, mod - 2);
	}
	ll mdiv(ll a, ll b) {
	  return mmul(a, minv(b));
	}
}

using namespace modop;

ll fact[2000005], ifact[2000005];

ll nck(ll n, ll k) {
  ll dem = (ifact[k] * ifact[n - k]) % mod;
  return (fact[n] * dem) % mod;
}

void solve() {
  ll n; string s; cin >> n >> s;
  ll k = s.length();

  ll tot = mpow(26, n + k);

  fact[0] = fact[1] = ifact[0] = ifact[1] = 1;
  f1r(i, 2, n + k + 3) {
    fact[i] = (fact[i - 1] * i) % mod;
    ifact[i] = minv(fact[i]);
  }

  ll sub = 0;
  f0r(i, k) {
    ll pos = mpow(25, n + k - i);
    pos = (pos * nck(n + k, i)) % mod;
    sub = (sub + pos) % mod;
  }

  cout << msub(tot, sub) << '\n';
}
 
int main() {
  fio();
  
  int T = 1;
  // cin >> T;
  while (T--) solve();
} 

Measured memory_bytes: 35696
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    rep(i,(int)s.size()){
        if(s[i]=='?') s[i]='D';
    }
    cout<<s<<endl;
}

Measured memory_bytes: 3756
#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 main() {
	int n;
	cin >> n;
	vector<P> p(n);
	rep(i, n) cin >> p[i].first >> p[i].second;
	double sum = 0.0;
	vector<int> def(n);
	iota(def.begin(), def.end(), 0);
	do {
		double tmp = 0.0;
		rep(i, n - 1) {
			tmp += sqrt(pow(p[def[i]].first - p[def[i + 1]].first, 2) + pow(p[def[i]].second - p[def[i + 1]].second, 2));
		}
		sum += tmp;
	} while (next_permutation(def.begin(), def.end()));
	double res = 1.0;
	rep(i, n) res *= (i + 1);
	cout << setprecision(10) << fixed << sum / res << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  ll n;
  cin >> n;
  vector<ll> vec(n);
  for (auto &v : vec)
    cin >> v;

  sort(vec.begin(), vec.end(), greater<ll>());

  if (n == 2) {
    cout << vec[0] << endl;
    return EXIT_SUCCESS;
  }

  ll score = vec[0] + vec[1];
  list<ll> tmp = {vec[0], vec[1], vec[2]};
  ll idx = 3;
  auto cur = next(tmp.begin(), 1);
  while (idx < n) {
    cur = tmp.insert(cur, vec[idx++]);
    if (next(cur, 1) == tmp.end()) {
      score += min(*tmp.begin(), *next(cur, -1));
      cur = next(tmp.begin(), 1);
    }
    else {
      score += min(*next(cur, 1), *next(cur, -1));
      cur = next(cur, 2);
    }
  }

  cout << score << endl;
}

Measured memory_bytes: 11180
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
typedef long long int ll;
using namespace std;
int main(){
	int n;
	cin >> n;
	if(n==25){
		cout<< "Christmas"<<endl;
	}else if(n==24){
		cout<<"Christmas Eve"<<endl;
	}else if(n==23){
		cout<<"Christmas Eve Eve"<<endl;
	}else{
		cout<<"Christmas Eve Eve Eve"<<endl;
	}
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
Distance = [abs(xi-yi) for (xi,yi) in zip(x,y)]
print(sum(Distance))#マンハッタン距離
Euclid=[i**2 for i in Distance]
print(sum(Euclid)**0.5)
wa = [i**3 for i in Distance]
print(sum(wa)**(1/3))
print(max(Distance))



Measured memory_bytes: 5652
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
ans = sum(A)
cnt = Counter(A)
Q = int(input())
for q in range(Q):
    b, c = map(int, input().split())
    ans += (c-b)*cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(ans)

Measured memory_bytes: 24208
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var array = cin.ReadLongArray(2);
            var gcd = Gcd(array[0], array[1]);
            var max = gcd;
            long i = 2;
            var yakusuHash = new HashSet<long> { 1 };
            while (true)
            {
                if (gcd % i == 0)
                {
                    yakusuHash.Add(i);
                    gcd = gcd / i;
                    if (gcd <= 1) break;
                }
                else
                {
                    if (i * i > max) break;
                    i++;
                }
            }
            if (gcd != 1) yakusuHash.Add(gcd);
            WriteLine(yakusuHash.Count);
        }
        public long Gcd(long a, long b)
        {
            if (a > b) return Gcd(b, a);
            while (true)
            {
                var mod = b % a;
                if (mod == 0) return a;
                b = a;
                a = mod;
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

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

using namespace std;

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

    int q;
    cin>>q;

    map<string,int> mp;
    while(q--){
        int op;
        string s;
        cin>>op>>s;
        switch(op)
        {
            case 0:
                int x;
                cin>>x;
                mp[s]=x;
                break;
            case 1:
                cout<<mp[s]<<endl;
                break;
            case 2:
                mp.erase(s);
        }
    }

    return 0;
}




Measured memory_bytes: 25848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
        string s, t;
        cin >> s >> t;
        vector<vector<int>>dp (s.size()+1, vector<int>(t.size()+1));
        for (int i = 0,I=1; i < s.size(); i++,I++)
        {
            for (int j = 0,J=1; j < t.size(); J++,j++)
            {
                if (s[i] == t[j])
                    dp[I][J] = 1 + dp[I - 1][J - 1];
                else
                    dp[I][J] = max(dp[I - 1][J], dp[I][J - 1]);
            }
        }
        
        int x = s.size(), y = t.size();
        string res;
        int cur = 0;
        while (x >= 1 && y >= 1)
        {
            if (s[x - 1] == t[y - 1])
            {
                res.push_back(s[x - 1]);
                x--;
                y--;
            }
            else
            {
                if (dp[x - 1][y] > dp[x][y - 1])
                    x--;
                else
                    y--;
            }
        }
        reverse(res.begin(), res.end());
        cout << res;
  return 0;
    }


Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;

#define rep(i,N) for(int i=0;i<(int)(N);++i)
#define rrep(i,N) for(int i=(int)(N)-1;i>=0;--i)
#define debug(x) cout<<#x<<"="<<x<<endl;
constexpr int MOD=1000000007;
constexpr ll INF=(1LL<<61)-1;
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
    int N;cin>>N;
    ll res=0;
    rep(i,N-1){
        int u,v;cin>>u>>v;u--;v--;
        if(u>v)swap(u,v);
        res-=(u+1LL)*(N-v);
    }
    for(int i=1;i<=N;i++)
        res+=i*(i+1LL)/2;
    cout<<res<<endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    solve();
    return 0;
}

Measured memory_bytes: 3644
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
# mod = 998244353
# mod = 10 ** 9 + 9
mod = 10 ** 9 + 7
PI = Math::PI
dx = [ 1,  0, -1,  0,  1,  1, -1, -1]
dy = [ 0,  1,  0, -1,  1, -1,  1, -1]
eight = [0, 1, 1, 0, -1, -1, 1, -1, 0]
def max(a,b);       a > b ? a : b                              end
def min(a,b);       a < b ?  a : b                             end
def swap(a,b);      a, b = b, a                                end
def gi;             gets.to_i                                  end
def gf;             gets.to_f                                  end
def gs;             gets.chomp                                 end
def gai(n=nil); n.nil? ? gets.split.map(&:to_i) : n.times.map{ gets.to_i } end
def gaf(n=nil); n.nil? ? gets.split.map(&:to_f) : n.times.map{ gets.to_f } end
def gas(n=nil); n.nil? ? gets.split : n.times.map{ gets.chomp } end
def ga2i(h);        h.times.map{ gets.split.map(&:to_i) }      end
def yn(f); puts f ? "Yes" : "No" end
def YN(f); puts f ? "YES" : "NO" end
def yes(f=nil); f.nil? ? (puts "Yes"; exit) : (puts f ? "Yes" : "No") end
def no(f=nil); f.nil? ? (puts "No"; exit) : (puts f ? "Yes" : "No") end
def yay(f=nil); f.nil? ? (puts "Yay!"; exit) : (puts f ? "Yay!" : ":(") end

s = gs

yn(s[2]==s[3] && s[4]==s[5])

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

#define MAX_N 200005
#define MOD ((int)(1e9 + 7))

int rankk[MAX_N];
int A100[MAX_N], B100[MAX_N];
int fast_pow(int a, int n){
	int res = 1;
	while(n > 0){
		if(n & 1) res = 1LL * res * a % MOD;
		a = 1LL * a * a % MOD;
		n >>= 1;
	}
	return res;
}
void init(int A, int B, int C){
	rankk[0] = 1;
	for(int i = 1; i < MAX_N; i++) rankk[i] = 1LL * rankk[i - 1] * i % MOD;
	A100[0] = B100[0] = 1;
	const int INV100 = fast_pow(100 - C, MOD - 2);
	for(int i = 1; i < MAX_N; i++){
		A100[i] = 1ll * A100[i - 1] * A % MOD * INV100 % MOD; 
		B100[i] = 1ll * B100[i - 1] * B % MOD * INV100 % MOD; 
	}
}

int get_nCr(int n, int r){
	return 1LL * rankk[n] * fast_pow(rankk[r], MOD - 2) % MOD * fast_pow(rankk[n - r], MOD - 2) % MOD;
}

int main() {
	// freopen("input.txt", "r", stdin);


	int N, A, B, C;
	scanf("%d %d %d %d", &N, &A, &B, &C);
	init(A, B, C);
	int res = 0;
	const int INV100 = fast_pow(100 - C, MOD - 2);
	for(int M = N; M <= N + N - 1; M++){
		int term = get_nCr(M - 1, N - 1);
		term = 1LL * term * (1LL * A100[N] * B100[M - N] % MOD + 1LL * A100[M - N] * B100[N] % MOD) % MOD * M % MOD;
		term = 1LL * term * 100 % MOD * INV100 % MOD;
		res = (res + term) % MOD;
	}
	printf("%d\n", res);
	return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

ll MergeSort(vector<int>& A){
	int num = A.size();
	if(num<=1) return 0;

	ll cnt=0;
	vector<int> B(A.begin(),A.begin()+num/2);
	vector<int> C(A.begin()+num/2,A.end());

	cnt += MergeSort(B);
	cnt += MergeSort(C);

	int ai=0,bi=0,ci=0;
	int bnum=B.size(),cnum=C.size();
	while(ai<num){
		if(bi<bnum && (ci==cnum || B[bi]<=C[ci])){
			A[ai++] = B[bi++];
		} else {
			cnt += num/2-bi;
			A[ai++] = C[ci++];
		}
	}
	return cnt;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	auto V=vecin(N);

	int sum=0;
	for(int i=0;i<N;i++){
		if(V[i]==i+1){
			if(i<N-1) swap(V[i],V[i+1]);
			else swap(V[i],V[i-1]);
			sum++;
		}
	}
	out(sum);
	return 0;
}


Measured memory_bytes: 640
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <ctime>
#include <map>
#include <deque>
#include <cmath>
#include <functional>
#include <queue>
#include <iomanip>
 
#define lp(i, s, e) for(int i = s; i < e; ++i)
#define lpi(i, s, e) for(int i = s; i<= e; ++i)
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;


const int maxn = 2e5;
int dp[maxn][2];




int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    dp[0][0] = 1;
    dp[0][1] = 0;
    lp(i, 1, n) {
    	dp[i][0] = dp[i - 1][1] + 1;
    	if (s[i] != s[i - 1]) {dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);}
    	if (i == 1) {
    		dp[i][1] = 1;
    		continue;
    	}
    	dp[i][1] = dp[i - 2][0] + 1;
    	if (i == 2) {
    		continue;
    	}
    	if (s[i - 3] != s[i - 1] || s[i - 2] != s[i]) {
    		dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
    	}
    }
    cout << max(dp[n - 1][0], dp[n - 1][1]);
    return 0;
}


// 


Measured memory_bytes: 2196
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize
    }
    let mut ans = 0;
    for i in 1..=n {
        if f(i) & 1 == 1 {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn f(n: usize) -> usize {
    let mut ret = 0;
    let mut n = n;
    while n > 0 {
        ret += 1;
        n /= 10;
    }
    ret
}


Measured memory_bytes: 2180
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, X = list(map(int, sys.stdin.buffer.readline().split()))

sizes = [1]
for _ in range(N):
    sizes.append(sizes[-1] * 2 + 3)
patties = [1]
for _ in range(N):
    patties.append(patties[-1] * 2 + 1)


def solve(n, x):
    if sizes[n] <= x:
        return patties[n]
    if x <= 0:
        return 0
    ret = 0
    ret += solve(n - 1, x - 1)
    ret += 1 if x > sizes[n] // 2 else 0
    ret += solve(n - 1, x - sizes[n] // 2 - 1)
    return ret


ans = solve(N, X)
print(ans)


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  string Ans = "No";
  
  if(a != b){
    if(a == c){
    Ans = "Yes";
    }else if(b == c){
    Ans = "Yes";
    }
  }else{
  	if(a != c){
    Ans = "Yes";
    }else if(b != c ){
    Ans = "Yes";
    }
  }
  
  cout << Ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    int maxsize = 0;
    for (int i=0; i<s.size(); i++) {
        for (int j=0; j<=s.size()-i; j++) {
            bool res = true;
            string subs = s.substr(i, j);
            for (int k=0; k<subs.size(); k++) {
                if (subs[k] != 'A' && subs[k] != 'G' && subs[k] != 'T' && subs[k] != 'C') {
                    res = false;
                }
            }

            if (res == false) continue;
            int size = subs.size();
            //cout << "size: " << size << endl;
            maxsize = max(maxsize, size);


        }
    }

    cout << maxsize << endl;


    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
        #define ll  long long
        #define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        #define rep(i,a,b)  for(ll i=a;i<b;i++)
        #define pb push_back
        #define Max(x,y,z) max(x,max(y,z))
        #define f first
        #define s second
        #define lbd lower_bound
        #define sz(x)       (ll)x.size()
        #define pi 3.1415926536
        #define mod 1000000007
        #define MOD 998244353
        using namespace std;
        const int N=100000;
        void solve()
        {
            ll n,m,k,res=0,l=0,r=0,z,sum1=0,cnt1=0,h,res1,a,b,c,d,x,y;
            ll W;
            string s,t;
            cin>>s>>t;
            n=sz(s);
            m=sz(t);
            ll cnt[n+1][m+1];
            memset(cnt,0,sizeof(cnt));
            rep(i,0,n)
            {
                rep(j,0,m)
                {
                    if(s[i]==t[j]) cnt[i+1][j+1]=cnt[i][j]+1;
                    else cnt[i+1][j+1]=max(cnt[i][j+1],cnt[i+1][j]);
                    //cout<<cnt[i+1][j+1]<<" ";
                }
                //cout<<"\n";
            }
            char lcs[cnt[n][m]];
            if(cnt[n][m])
            {
                ll index=cnt[n][m];
                ll i=n,j=m;
                while(i>0 && j>0)
                {  
                    if(s[i-1]==t[j-1]) {lcs[index-1]=s[i-1];
                    i--;j--;index--;}
                    else if(cnt[i-1][j]>cnt[i][j-1])
                        i--;
                    else j--;
                }
            }
            rep(k,0,cnt[n][m]) cout<<lcs[k];


            
        
     
    }
        int main()
        {   
            /*#ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
            #endif*/
     
            speed_up
            ll t;
            //cin>>t;
            t=1;
            while(t--)
                solve();
        }

Measured memory_bytes: 70656
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;

ll H,W;
ll solve(ll H, ll W) {
    ll res;
    if(H % 3 == 0) res = 0;
    else res = W;
    rrep(h,H) {
        vl S(3);
        S[0] = h * W;
        S[1] = (H - h) * (W/2);
        S[2] = (H - h) * (W - (W/2));
        sort(all(S));
        chmin(res, S[2]-S[0]);
    }
    return res;
}

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

cin >> H >> W;
ll ans = min(solve(H, W), solve(W, H));
cout << ans << endl;

return 0;
}

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

int main() {
	string s; cin >> s;
	string ans;
	for (char c : s) {
		if (c == 'B') {
			if (!ans.empty())ans.pop_back();
		}
		else ans.push_back(c);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List

getInts :: (Num a, Read a) => IO [a]
getInts = do
    line <- getLine
    return $ map read $ words line

cmp (s1, p1, _) (s2, p2, _)
    | s1 == s2 = compare (-p1) (-p2)
    | otherwise = compare s1 s2

main = do
    [n] <- getInts
    sp <- forM [1..n] $ (\i -> do
        l <- getLine
        let [s, p] = words l
        return (s, read p :: Int, i))
    mapM_ print $ map (\(_, _, x) -> x) $ sortBy cmp sp


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

struct Point {
  double x, y;
};

void koch(int n, Point a, Point b) {
  if (n==0) {
    return;
  }
  Point s, u, t;
  double theta = M_PI*2/3;
  s.x = a.x*2/3 + b.x*1/3;
  s.y = a.y*2/3 + b.y*1/3;
  t.x = a.x*1/3 + b.x*2/3;
  t.y = a.y*1/3 + b.y*2/3;
  u.x = cos(theta)*(b.x-t.x) - sin(theta)*(b.y-t.y) + t.x;
  u.y = sin(theta)*(b.x-t.x) + cos(theta)*(b.y-t.y) + t.y;

  koch(n-1, a, s);
  cout << s.x << " " << s.y << endl;
  koch(n-1, s, u);
  cout << u.x << " " << u.y << endl;
  koch(n-1, u, t);
  cout << t.x << " " << t.y << endl;
  koch(n-1, t, b);
}

int main() {
  int n;
  Point a, b;
  cin >> n;
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  cout << a.x << " " << a.y << endl;
  koch(n, a, b);
  cout << b.x << " " << b.y << endl;
  return 0;
}



Measured memory_bytes: 3224
S = input()
isEasy = True
for i, char in enumerate(S):
    if char == "L":
        if i % 2 == 1: continue
        else:
            isEasy = False
            break
    elif char == "R":
        if i % 2 == 0: continue
        else:
            isEasy = False
            break
judge = "Yes" if isEasy else "No"
print(judge)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n,k;
	cin>>n>>k;
	int array[n];
	for(int x=0;x<n;x++){
		cin>>array[x];
	}
	int dp[n];
	dp[0]=0;
	for(int x=0;x<=k&&x<n;x++){
		dp[x]=abs(array[x]-array[0]);
		for(int i=0;i<x;i++){
			dp[x]=min(dp[x],dp[i]+abs(array[x]-array[i]));
		}
	}
	for(int x=k+1;x<n;x++){
		dp[x]=dp[x-k]+abs(array[x]-array[x-k]);
		for(int i=x-k;i<x;i++){
			dp[x]=min(dp[x],dp[i]+abs(array[x]-array[i]));
		}
	}
	cout<<dp[n-1];
	
	
	
	
	
	
return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
  int r, c, i, j, x, sr, sc[101] = {0};

  scanf("%d %d", &r, &c);

  for (i = 0; i < r; i++) {
    sr = 0;

    for (j = 0; j < c; j++) {
      scanf("%d", &x);
      printf("%d ", x);

      sr += x;
      sc[j] += x;
    }

    sc[j] += sr;

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

  for (i = 0; i <= c; i++) {
    printf("%d%c", sc[i], i == c ? '\n' : ' ');
  }

  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005,INF=1<<30;
vector<int> G[MAX],deg(MAX),used(MAX);
queue<int> Q;
int N;
bool ok=true;

void BFS(){
    while(!Q.empty()){
        int a=Q.front();Q.pop();
        if(used[a]) continue;
        used[a]=1;
        for(int i=0;i<G[a].size();i++){
            int b=G[a][i];
            if(!used[b]){
                used[b]=1;
                for(int j=0;j<G[b].size();j++){
                    int c=G[b][j];
                    if(!used[c]){
                        deg[c]--;
                        if(deg[c]==1) Q.push(c);
                        //break;
                    }
                }
                break;
            }
            if(i==G[a].size()-1) ok=false;
        }
    }
}

int main(){
    
    cin>>N;
    for(int i=0;i<N-1;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    
    for(int i=0;i<N;i++){
        if(deg[i]==1){
            Q.push(i);
            //used[i]=1;
        }
    }
    
    if(N%2==1){
        cout<<"First"<<endl;
        return 0;
    }
    
    BFS();
    
    if(!ok) cout<<"First"<<endl;
    
    else cout<<"Second"<<endl;
}






Measured memory_bytes: 8576
#include <bits/stdc++.h>
using ll = long long;
int main()
{
  ll N, A, B, C, D, E;
  std::cin >> N >> A >> B>> C >> D>> E;
  const ll m = std::min({A,B,C,D,E});
  std::cout << (N+m-1)/m+4LL<<std::endl;
  return 0;
}

Measured memory_bytes: 384
while 1:
	n = input()
	if n == 0: break
	ans = 0
	for i in range(1,n/2+1): 
		s = i
		for j in range(i+1,n/2+2):
			s += j
			if s >= n:
				if s == n:
					ans += 1
				break
	print ans

Measured memory_bytes: 4220
s = input().split()
s = [int(i) for i in s]
a = s[0]
b = s[1]

if a % 3 == 0 : print("Possible")
elif b % 3 == 0 : print("Possible")
elif (a + b) % 3 == 0 : print("Possible")
else : print("Impossible")

Measured memory_bytes: 3316
s = input()
a = s[0:2]
b = s[2:4]
month = ["0"+str(i) for i in range(1,10)]+["10","11","12"]

if a in month and b in month: ans = "AMBIGUOUS"
elif a in month: ans = "MMYY"
elif b in month: ans = "YYMM"
else: ans = "NA"

print(ans)


Measured memory_bytes: 3060
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int S = nextInt();
    int W = nextInt();

    if(W>=S){
      System.out.println("unsafe");
    }
    else{
      System.out.println("safe");
    }
    //

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

  static double nextDouble(){
    return Double.parseDouble(sc.next());
  }

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Measured memory_bytes: 35544
#include<iostream>
 
using namespace std;
 
int main() {
	long long A, B;
	cin >> A >> B;
 
	if (A % 2 != B % 2) {
		cout << "IMPOSSIBLE" << endl;
	}
	else {
		cout << (A + B) / 2 << endl;
	}
return 0;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define pi acos(-1.0)
#define lowbit(x) ((x)&(-(x)))
#define debug(x) cout<<x<<'\n'
#define pii pair<ll,pair<ll,ll> >
using namespace std;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9+7;
const double eps = 1e-6;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll mul(ll a,ll b){ll ans=0;a%=mod,b%=mod;while(b) { if(b&1) ans = (ans+a)%mod; a = (a*2)%mod; b >>= 1; }return ans;}
ll powmod(ll a,ll b){ ll ans = 1, pow = a; while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; } return ans;}
//(b/a)%p=b*a^(p-2)%p
//int pr(ll num){//判素
//     if(num == 1) return 0;
//     if(num ==2|| num==3 ) return 1 ;
//     if(num %6!= 1&&num %6!= 5) return 0 ;
//     int tmp =sqrt( num);
//     for(int i= 5;i <=tmp; i+=6 )
//          if(num %i== 0||num %(i+ 2)==0 )return 0 ;
//     return 1 ;
//}
int Day(int y,int m, int d){if(m==1||m==2) { m+=12; y--; }int w=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;return w+1;}
//int pri[10000005];
//void getpri(){
//    memset(pri,true,sizeof(pri));
//    pri[0]=pri[1]=0;
//    for(int i=2;i<=10000000;i++){
//        if(pri[i]){
//            for(int j=2*i;j<=10000000;j+=i) pri[j]=0;
//        }
//    }
//}
//struct ac{
//    int x,y;
//    int fa;
//} pre[10000005];
//void init(){
//    for(int i=1; i<=10000005;++i) pre[i].fa=i;
//}
//int getf(int x){
//    if(pre[x].fa == x) return x;
//    else return pre[x].fa = getf(pre[x].fa);
//}
//void join(int x,int y){
//    int a = getf(x);
//    int b = getf(y);
//    if(a!=b) pre[b].fa=a;
//}
//大小写转换
//String s;
//Form(s.begin(),s.end(),s.begin(),::toupper);
//Form(s.begin(),s.end(),s.begin(),::tolower);
//(char)toupper('a')
//(char)tolower('B')
//#pragma comment(linker, "/STACK:1024000000,1024000000")//外挂开栈
//stable_sort 排序不处理相同元素
//map<int,int>::reverse_iterator rit;
//for(rit=mp.rbegin();rit!=mp.rend();rit++)
//vec动态二维数组
//vector<vector<int>> g(26,vector<int>(100005));
//初始化vec里面套了n个vec
//lower_bound(begin,end,num) 有序数列中返回第一个>=num的数字的地址
//upper_bound( begin,end,num) 返回第一个>num的数字的地址
const int maxn=305;
double dp[maxn][maxn][maxn];
int a[4]={0};
int n;
double dfs(int x,int y,int z){
    if(dp[x][y][z]>0) return dp[x][y][z];
    if(!x&&!y&&!z) return 0;
    int s=x+y+z;
    double ans=1.0*n/s;
    if(x) ans+=1.0*dfs(x-1,y,z)*x/s;
    if(y) ans+=1.0*dfs(x+1,y-1,z)*y/s;
    if(z) ans+=1.0*dfs(x,y+1,z-1)*z/s;
//    cout<<ans<<endl;
    return dp[x][y][z]=ans;
}
int main(){
    cin>>n;
    //memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;++i){
        int x;
        cin>>x;
        a[x]++;
    }
    double ans= dfs(a[1], a[2], a[3]);
    printf("%.10f\n",ans) ;
    return 0;
}


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

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << 60 * (h2 - h1) + (m2 - m1) - k << endl;
    return 0;
}


Measured memory_bytes: 3612