akhauriyash/Code-Regression huggingface dataset:
// #include <bits/stdc++.h>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<map>
#include<set>
#include<vector>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<string>
#include<tuple>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                             in(T &p){cin>>p;}
template<class T1,class T2>inline void                   in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void          in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T>inline void                             ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
template<class T>inline void                             outs(T p){for_each(all(p),out<decltype(p[0])>);}
string s;
inline void solve(void){
  in(s);
  cout<<s.substr(0,4)<<" "<<s.substr(4,8)<<endl;
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s[3];
    cin>>s[0]>>s[1]>>s[2];
    
    int c=0;
    char ans;
    while(s[c].size()>0){
        char C = s[c][0];
        s[c].erase(s[c].begin());
        switch(C){
            case 'a':
            c = 0;
            ans = 'A';
            break;
            case 'b':
            c = 1;
            ans = 'B';
            break;
            case 'c':
            c = 2;
            ans = 'C';
            break;
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a<=c&&c<=b)||(b<=c&&c<=a)){
  cout<<"Yes"<<endl;
  }else {
  cout<<"No"<<endl;
  }
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int N_MAX = 300001;
int main()
{
  int n,m,u,vv,s,t,i,j;
  int d[N_MAX];
  vector<int> v[N_MAX];
  queue<int> q;
  cin >> n >> m;
  for(i=0;i<m;i++){
    cin >> u >> vv;
    v[u].push_back(n+vv);
    v[n+u].push_back(2*n+vv);
    v[2*n+u].push_back(vv);
  }
  cin >> s >> t;
  fill(d+1,d+3*n+1,-1);
  d[s]=0;
  q.push(s);
  while(!q.empty()){
    i=q.front(); q.pop();
    for(j=0;j<v[i].size();j++)
      if(d[v[i][j]]<0){
        d[v[i][j]]=d[i]+1;
        q.push(v[i][j]);
        if(v[i][j]==t){
          cout << d[t]/3 << endl;
          return 0;
        }
      }
  }
  cout << "-1" << endl;
  return 0;
}


Measured memory_bytes: 21188
#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int i,j;
	int temp;
	int data[n];
	for(i=0;i<n;i++){
		scanf("%d",&data[i]);
	}
	for(i=0;i<n;i++){
		temp=data[i];
		j=i;
		while(j>0&&data[j-1]>temp){
			data[j]=data[j-1];
			j--;
		}
		data[j]=temp;
		for(j=0;j<n;j++){
			printf("%d",data[j]);
      if(j!=n-1)printf(" ");
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2716
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>

using namespace :: std;


const ll maxn=4010;
const ll inf=1e9+500;
const ll mod=1e9+7;

ll dp[maxn][maxn];
ll pr[maxn][maxn];

int main(){
    ll n,m,k;
    cin>>n>>m>>k;

    for(ll i=1;i<k;i++){
        dp[i][1]=1;
    }
    pr[0][1]=dp[0][1];
    for(ll i=1;i<=n;i++){
        pr[i][1]=(pr[i-1][1]+dp[i][1])%mod;
    }
    for(ll l=2;l<maxn;l++){
        for(ll i=0;i<=n;i++){
            ll p=min(k-1,i);
            dp[i][l]=pr[i][l-1];
            if(i-p-1 >=0){
                dp[i][l]-=pr[i-p-1][l-1];
            }
            dp[i][l]+=mod;
            dp[i][l]%=mod;
        }

        pr[0][l]=dp[0][l];
        for(ll i=1;i<=n;i++){
            pr[i][l]=(pr[i-1][l]+dp[i][l])%mod;
        }
    }


    ll ans=0;
    for(ll l=0;l<maxn;l++){
        for(ll z=1;z<=n;z++){
            ll u=l*(k-1)-z;
            if(u>=0 && z%(k-1)==n%(k-1)  && u%(k-1)==(m-1)%(k-1) && u<=m-1 ){
                ans+=dp[z][l];
                ans%=mod;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 127232
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    //what do i want to do
    //just go to adjacent stuff with 0 cost and transfer line for 1 cost
    //it's not that difficult...
    map<pair<int,int>,vector<int> > adj; //<p,c>,q
    vector<int> clist[m+5];
    for (int i=0; i<m; i++){
        int p,q,c;
        cin >> p >> q >> c;
        adj[make_pair(p,c)].push_back(q);
        adj[make_pair(q,c)].push_back(p);
        clist[p].push_back(c);
        clist[q].push_back(c);
    }
    map<pair<int,int>,int> dis;
    map<pair<int,int>,int> vis;
    int vil[n+5]; memset(vil,0,sizeof(vil));
    deque<pair<int,int> > q;
    for (auto kk : adj){
        if (kk.first.first == 1){ dis[kk.first]=1; q.push_back(kk.first);}
    }
    int iter=0;
    while(!q.empty()){
        pair<int,int> vc = q.front();
        int v=vc.first, c=vc.second; q.pop_front();
        if(vis.find(vc)!=vis.end()) continue;
        vis[vc]=1;
        if (vil[v]) goto ahc;
        vil[v]=1;
        for(int i : clist[v]){
            pair<int,int> np = make_pair(v,i);
            if (dis.find(np)==dis.end()) dis[np]=dis[vc]+1;
            else dis[np]=min(dis[np],dis[vc]+1);
            q.push_back(np);
            //cout<<'a'<<endl;
        }//O(NM) edges
        ahc: ;
        for (int i : adj[vc]){
            pair<int,int> np = make_pair(i,c);
            if (dis.find(np)==dis.end()) dis[np]=dis[vc];
            else dis[np]=min(dis[np],dis[vc]);
            q.push_front(np);
            //cout<<'b'<<endl;
        }
        //cout<<vc.first<<' '<<vc.second<<endl;
    }
    int an=1e9;
    for (auto tk : dis){
        if(tk.first.first==n) an = min(an,tk.second);
    }
    if(an==1e9)cout<<-1;
    else cout<<an;
}

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

int N, M;

void dfs(int n, vector<vector<int>> &Graph, vector<bool> &seen) {
    seen[n] = true;
    for (auto x : Graph[n]) {
        if (!seen[x]) dfs(x, Graph, seen);
    }
    return;
}

bool bridge(int n, vector<int> &a, vector<int> &b) {
    int cnt = 0;
    vector<bool> seen(N, false);
    vector<vector<int>> Graph(N);
    rep(i, M) {
        if (i == n) continue;
        Graph[a[i]].push_back(b[i]);
        Graph[b[i]].push_back(a[i]);
    }

    rep(i, N) if (!seen[i]) {
        ++cnt;
        dfs(i, Graph, seen);
    } 
    if (cnt == 1) return false;
    else return true;
}



int main() {
    cin >> N >> M;
    vector<int> a(M), b(M);
    rep(i, M) {
        cin >> a[i] >> b[i];
        --a[i];
        --b[i];
    }

    int ans = 0;
    rep(i, M) if (bridge(i, a, b)) ++ans;
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void){
  int i,j,n,m,cn;
  char c,s[5]={'S','H','C','D','\0'};
  static int card[4][13];
  scanf("%d\n",&n);

  for(i=0;i<n;i++){
    scanf("%c %d\n",&c,&m);
    for(j=0;j<4;j++)
      if(s[j]==c)
        card[j][m-1]=1;
  }
  
  for(i=0;i<4;i++)
    for(j=0;j<13;j++)
      if(card[i][j]==0)
        printf("%c %d\n",s[i],j+1);

  return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x;
	cin >> x;
	vector<bool> dp(x + 120,false);
	dp[100] = true;
	dp[101] = true;
	dp[102] = true;
	dp[103] = true;
	dp[104] = true;
	dp[105] = true;
	for (int i = 1; i <= x; ++i) {
		if (dp[i]) {
			dp[i + 100] = true;
			dp[i + 101] = true;
			dp[i + 102] = true;
			dp[i + 103] = true;
			dp[i + 104] = true;
			dp[i + 105] = true;
		}
	}
	if (dp[x]) puts("1");
	else puts("0");
	return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{

	int N, K;
	cin >> N >> K;
	vecl(A);
	pb(A, 0);
	fx(N) {
		vecpl(A);
		A[x + 1] += A[x];
	}
	vecl(B);
	fx(N+1) {
		fyg(N+1,x+1) {
			pb(B, A[y] - A[x]);
		}
	}
	ll mask = 1ll << 62;
	while (mask>0) {
		vecl(C);
		fx(B.size()) {
			if ((B[x]&mask)!=0) {
				pb(C, B[x]);
			}
		}
		if (C.size()>=K) {
			B = vector<ll>(C);
		}
		mask >>= 1;
	}

	ll ans = B[0];
	fx(K-1) {
		ans &= B[x + 1];
	}
	ce(ans)


    return 0;
}



Measured memory_bytes: 6396
// In the name of Allah the most Merciful.

#include<bits/stdc++.h>
using namespace std;

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

    char ar[n+1][n+1];
    char br[m+1][m+1];

    for(int i=0;i<n;i++)cin >> ar[i];
    for(int i=0;i<m;i++)cin >> br[i];

    if(m>n)cout << "No" << endl;
    else if(m==n){

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

            for(int j=0;j<n;j++){

                if(ar[i][j]!=br[i][j]){

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

        cout << "Yes" << endl;

        return 0;
    }
    else{

        bool check = true;

        for(int i=0;i<n-m;i++){

            for(int j=0;j<n-m;j++){

                check = true;

                for(int k=0;k<m;k++){

                    for(int l=0;l<m;l++){

                        if(ar[i+k][j+l]!=br[k][l])check=false;
                    }
                }

                if(check==true){

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


        }
    }

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


Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    N,L=pin()
    SS=[input() for i in range(N)]
    SS.sort()
    #print(SS)
    print(*SS,sep="",end='\n')
#%%submit!
resolve()

Measured memory_bytes: 38256
//*Here I go out to sea again
//*The sunshine fills my hair
//*And dreams hang in the air

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
void input(){freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);}

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    ll c=0;
    ll k=false;
    while(t--){
      ll a,b;
      cin>>a>>b;
      if(a==b){
        ++c;
        if(c>=3){
          k=true;
          break;
        }
      }
      else{
        c=0;
      }
    }
    if(k){
      cout<<"Yes"<<"\n";
    }
    else{
      cout<<"No"<<"\n";
    }

    return 0;
}


Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){

	int n,i,tmp;

	cin >> n;

	for(i=1;i<=n;i++){
		if(i % 3 == 0){
			cout << " " << i;
		}
		else{
			tmp = i;
			for(;;){
				if(tmp % 10 == 3){
					cout << " " << i;
					break;
				}
				else{
					tmp /= 10;
					if(tmp == 0)
						break;
				}
			}
		}
	}
	cout << endl;

	return 0;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

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

	cin >> a >> b >> c;

	ll sum = a + b + c;

	ll x = max(a, b);
	ll y = max(x, c);

	ll z = y * 3 - sum;

	if (z % 2 == 0) {
		cout << z / 2 << endl;
	}
	else {
		cout << (z + 3) / 2 << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int n,x,k,l,r,i;
  cin>>s;
  n=s.length();
  vector<int> v;
  x=1;
  for(i=1;i<n;i++){
    if(s.at(i)==s.at(i-1)) x++;
    else{
      v.push_back(x);
      x=1;
    }
  }
  v.push_back(x);
  k=n;
  l=0;
  r=v.size()-1;
  while(l<r){
    if(v.at(l)<=v.at(r)){
      k=min(k,n-v.at(l));
      v.at(l+1)+=v.at(l);
      v.at(l)=0;
      l++;
    }
    else if(v.at(l)>v.at(r)){
      k=min(k,n-v.at(r));
      v.at(r-1)+=v.at(r);
      v.at(r)=0;
      r--;
    }
  }
  cout<<k<<endl;
}

Measured memory_bytes: 3924
#include<bits/stdc++.h>
using namespace std;
string st;
int main(){
	cin >> st;
	int sum = 0;
	for (int i = 0; i < st.size(); i++) sum += st[i] - '0';
	if (sum % 9 == 0) cout << "Yes\n";
	else cout << "No\n";
  return 0;
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;
void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}



// class menu{ll s, ll e, ll val}

int main(){
    ll n,t; cin >> n >> t;
    // vector<ll> a(n),b(n);
    vector<Pll> ab(n);
    vvl dp(2, vector<ll>(t+10,0));
    vector<vector<vector<bool>>> ok(2,vector<vector<bool>>(t+10,vector<bool>(n,false)));
    rep(i,n){
        // cin >> a[i] >> b[i];
        ll a,b; cin >> a >> b;
        ab[i] = Pll(a, b);
    }
    sort(all(ab));
    ll res = 0;
    rep(i,n){
        rep(j,t+1){
            if(j < ab[i].first){
                dp[(i+1)%2][j] = dp[i%2][j];
                ok[(i+1)%2][j] = ok[i%2][j];
            }
            else {
                if(dp[i%2][j] < dp[i%2][j-ab[i].first] + ab[i].second){
                    dp[(i+1)%2][j] = dp[i%2][j-ab[i].first] + ab[i].second;
                    ok[(i+1)%2][j] = ok[i%2][j-ab[i].first];
                    ok[(i+1)%2][j][i] = true;
                }
                else{
                    dp[(i+1)%2][j] = dp[i%2][j];
                    ok[(i+1)%2][j] = ok[i%2][j];
                }
                // dp[i+1][j] = max(dp[i][j],dp[i][j-a[i]] + b[i]);
            }
        }
        rep(k,n){
            if(ok[(i+1)%2][t-1][k])continue;
            res = max(res,dp[(i+1)%2][t-1] + ab[k].second);
        }
    }
    // print(dp);
    // ll res = dp[n%2][t-1];
    // // print(res);
    // rep(i,n){
    //     cout << int(ok[n%2][t-1][i]) << " ";
    // }
    // // cout << endl;
    // rep(i,n){
    //     if(ok[n%2][t-1][i])continue;
    //     res = max(res,dp[n%2][t-1] + b[i]);
    // }
    cout << res << endl;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int a, b, x;
    cin >> a >> b >> x;
    double theta;
    if (a * a * b <= 2 * x)
    {
        theta = atan(2.0 * (a * a * b - x) / (a * a * a));
    }
    else
    {
        theta = PI / 2 - atan(2.0 * x / (b * b * a));
    }
    cout << theta * 180 / PI << "\n";
    return 0;
}

Measured memory_bytes: 4012
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=1e5+5;
ll a[N];
int main()
{
    ft
    ll t,i,j,n,m,l,r;
    cin>>n>>m>>l;
    for(i=1;i<=n;i++)
    {
        a[i]=m;
    }
    for(i=0;i<l;i++)
    {
        cin>>r;
        a[r]++;
    }
    for(i=1;i<=n;i++)
    {
        a[i]-=l;
    }
    for(i=1;i<=n;i++)
    {
        if(a[i]>0)
        {
            cout<<"Yes\n";
        }
        else
        {
            cout<<"No\n";
        }
    }
    return 0;
}



Measured memory_bytes: 1408
import Control.Monad (replicateM)
import Data.Array (listArray,(!))

type StickInfo = (Int,Int,Int,Int)
data Mobile = Stick Integer Integer Mobile Mobile
            | Weight

main = do
    n <- readLn
    if n == 0 then return () else do
        ss <- replicateM n (getLine >>= return . stickInfo . map read . words)
        print $ minWeight $ mobile n ss
        main

    where
    stickInfo [a,b,c,d] = (a,b,c,d)

mobile :: Int -> [StickInfo] -> Mobile
mobile n ss = mobile' root
    where
    root = head $ filter (not . (`elem` sub)) [1..n]
    sub = (map (\(_,_,a,_)->a) ss) ++ (map (\(_,_,_,b)->b) ss)
    sa = listArray (1,n) ss

    mobile' 0 = Weight
    mobile' n = Stick (fromIntegral a) (fromIntegral b) (mobile' c) (mobile' d)
        where
        (a,b,c,d) = sa ! n

minWeight :: Mobile -> Integer
minWeight Weight = 1
minWeight (Stick l1 l2 m1 m2) = lcm' `seq` (lcm' `div` l1) + (lcm' `div` l2)
    where
    lcm' = lcm (l1 * w1) (l2 * w2)
    w1 = minWeight m1
    w2 = minWeight m2

Measured memory_bytes: 4484
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    int n;
    cin >> n;
    int x;
    cin >> x;
    if(x==1||x==2*n-1){
        cout << "No" << endl;
        return 0;
    }else{
        cout << "Yes" << endl;
        int k = 2*n-1;
        vector<int>a(k+1);
        rep(i,k){
            a[i+1] = i+1;
        }
        swap(a[x],a[n]);
        swap(a[n-1],a[1]);
        swap(a[n+1],a[k]);
        rep(i,k){
            cout << a[i+1] << endl;
        }
        return 0;
    }
}


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

int main(){
  long long int h,w,a,b;
  long long int ans,M,m,X,Y,Z;
  cin>>h>>w;
  if(h*w%3==0){
    cout<<0<<endl;
    return 0;
  }
	
  ans=min(h,w);
  for(int k=0;k<2;++k){
    for(int i=0;i<=1;++i){
      for(int j=0;j<=1;++j){
        a=w/3+i;b=h/2+j;
        X=a*h;
        Y=b*(w-a);
        Z=(w-a)*(h-b);
        M=max(X,Y);
        M=max(M,Z);
        m=min(X,Y);
        m=min(m,Z);
        ans=min(ans,M-m);	
      }
    }
    swap(h,w);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string S;
  cin>>S;
  int ans=0;
  for(int i=0;i<3;i++)
  	if(S[i]=='R')
    {
      int cnt=0;
      for(int j=i;j<3;j++)
        if(S[j]=='R')
          cnt++;
      	else	break;
      ans=max(ans,cnt);
    }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

mod = 10**9+7
def comb(n, k):
    c = 1
    for i in range(k):
        c *= n - i
        c %= mod
    d = 1
    for i in range(1, k + 1):
        d *= i
        d %= mod
    return (c * pow(d, mod - 2, mod)) % mod


x,y = map(int, input().split())

if (x + y) % 3 != 0:
    print(0)
    exit()

# 公式解説解答
# n = (x + y) // 3
# x -= n
# y -= n
# if x < 0 or y < 0:
#     print(0)
#     exit()
# print(comb(x + y, x))

# x = 2a + b
# y = a + 2b
# 連立方程式を解いてa,bを求める
# あとはa,bの同じものを含む順列(a+b)!/a!b!
a = (2 * x - y) // 3
b = (-x + 2 * y) // 3
if a < 0 or b < 0:
    print(0)
    exit()
print(comb((x + y) // 3, a))


Measured memory_bytes: 9224
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<math.h>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	int cnt1=0,cnt2=0,len;
	string str;
	while(cin >> str){
		len=str.size();
		REP(i,len){
			if(str.substr(i,3)=="JOI")
				cnt1++;
			if(str.substr(i,3)=="IOI")
				cnt2++;
		}
		cout << cnt1 << endl << cnt2 << endl;
		str.clear();
		cnt1=0;
		cnt2=0;
	}
	return 0;
}

			

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

int main(void) {
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << (n/2) * (n/2) << endl;
  }
  else {
    cout << (n/2) * ((n+1)/2) << endl;
  }
}

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

int main() {
        int n, A[100], i;
        cin >> n;
        for (i = 1; i <= n; i++) cin >> A[i];
        for (int j = n; j >= 1; j--) {
                if (j < n) cout << " ";
                cout << A[j];
        }
        cout << endl;
}

Measured memory_bytes: 3100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var csl = Console.ReadLine();
            var N = ulong.Parse(csl.Split(' ')[0]);
            var M = ulong.Parse(csl.Split(' ')[1]);

            long sa = (long)N - (long)M;
            if (sa < 0)
            {
                sa = -1 * sa;
            }

            if (sa >= 2)
            {
                Console.WriteLine(0);
            }
            else if (sa == 1)
            {
                ulong n_kai = N;
                for (ulong n = N - 1; n > 0; n--)
                {
                    n_kai *= n;
                    if (n_kai > 1000000007)
                    {
                        n_kai %= 1000000007;
                    }
                }

                ulong m_kai = M;
                for (ulong m = M - 1; m > 0; m--)
                {
                    m_kai *= m;
                    if (m_kai > 1000000007)
                    {
                        m_kai %= 1000000007;
                    }
                }
                
                ulong result = n_kai * m_kai;
                if (result > 1000000007)
                {
                    Console.WriteLine(result % 1000000007);
                }
                else
                {
                    Console.WriteLine(result);
                }
            }
            else if (sa == 0)
            {
                ulong n_kai = N;
                for (ulong n = N - 1; n > 0; n--)
                {
                    n_kai *= n;
                    if (n_kai >= 1000000007)
                    {
                        n_kai %= 1000000007;
                    }
                }

                ulong m_kai = M;
                for (ulong m = M - 1; m > 0; m--)
                {
                    m_kai *= m;
                    if (m_kai >= 1000000007)
                    {
                        m_kai %= 1000000007;
                    }
                }

                ulong result = 2 * n_kai * m_kai;
                if (result > 1000000007)
                {
                    Console.WriteLine(result % 1000000007);
                }
                else
                {
                    Console.WriteLine(result);
                }
            }
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
bool get(int a){
	int num=0;
	while(a!=0){
		a=a/10;
		num++;
	}
	if(num%2==1){
		return 1;
	}else{
		return 0;
	}
}
int main(){
	int n;
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++){
		if(get(i)){
			sum++;
		}
	}
	printf("%d",sum);
}

Measured memory_bytes: 256
#include<stdio.h>
main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==5&&b==5&&c==7)
	printf("YES\n");
	else if(a==5&&c==5&&b==7)
	printf("YES\n");
	else if(a==7&&b==5&&c==5)
	printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, m;
		n = sc.nextInt();
		m = sc.nextInt();
		sc.close();
		
		int ans = (n - 1) * (m - 1);
		System.out.println(ans);
	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string s;
  cin >> s;
  ll sum=0;
  vector<int> a(s.size()+1);
  for(int i=0; i<s.size(); i++){
    if(s[i]=='<'){
      a[i+1]=max(a[i+1],a[i]+1);
    }
  }
  for(int i=0; i<s.size(); i++){
    if(s[s.size()-i-1]=='>'){
      a[s.size()-i-1]=max(a[s.size()-i]+1,a[s.size()-i-1]);
    }
  }
  for(int i=0; i<=s.size(); i++){
    sum+=a[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 2820
#include <bits/stdc++.h>
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;
 
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
using namespace std;

int main()
{
	fast;
	string s; cin>>s; ll flag = 0;
	for(ll i = 0; i < s.size(); i++)
	{
		if(s[i] - '0' == 7) flag = 1;
	}
	if(flag == 1) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    string s;
    cin >> s;
    int a;
    if(s=="SUN")a=7;
    else if(s=="MON")a=6;
    else if(s=="TUE")a=5;
    else if(s=="WED")a=4;
    else if(s=="THU")a=3;
    else if(s=="FRI")a=2;
    else a=1;
    cout << a << endl;

}

Measured memory_bytes: 3448
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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; }

#define keta setprecision(15) //15桁表示



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

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

	cout << 6 - a - b << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
using namespace std;
const int MAXN = 500;
int a[MAXN + 5][MAXN + 5];
int lst[MAXN + 5];
struct node{
	int a, b, c, d;
	node(int a, int b, int c, int d):a(a), b(b), c(c), d(d){}
};
vector<node>ans;
int main() {
	int H, W;
	scanf("%d%d", &H, &W);
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++) {
			scanf("%d", &a[i][j]);
			a[i][j] = (a[i][j] & 1);
		}
	int x1 = 1, x2 = H, y1 = 1, y2 = W;
	while( x1 <= x2 && y1 <= y2 ) {
		if( x1 == x2 ) {
			for(int i=y1;i<y2;i++) {
				if( a[x1][i] & 1 ) {
					a[x1][i] ^= 1;
					a[x1][i+1] ^= 1;
					ans.push_back(node(x1, i, x1, i+1));
				}
			}
			break;
		}
		else if( y1 == y2 ) {
			for(int i=x1;i<x2;i++) {
				if( a[i][y2] & 1 ) {
					a[i][y2] ^= 1;
					a[i+1][y2] ^= 1;
					ans.push_back(node(i, y2, i+1, y2));
				}
			}
			break;
		}
		for(int i=y1;i<y2;i++) {
			if( a[x1][i] & 1 ) {
				a[x1][i] ^= 1;
				a[x1][i+1] ^= 1;
				ans.push_back(node(x1, i, x1, i+1));
			}
		}
		for(int i=x1;i<x2;i++) {
			if( a[i][y2] & 1 ) {
				a[i][y2] ^= 1;
				a[i+1][y2] ^= 1;
				ans.push_back(node(i, y2, i+1, y2));
			}
		}
		for(int i=y2;i>y1;i--) {
			if( a[x2][i] & 1 ) {
				a[x2][i] ^= 1;
				a[x2][i-1] ^= 1;
				ans.push_back(node(x2, i, x2, i-1));
			}
		}
		for(int i=x2;i>x1+1;i--) {
			if( a[i][y1] & 1 ) {
				a[i][y1] ^= 1;
				a[i-1][y1] ^= 1;
				ans.push_back(node(i, y1, i-1, y1));
			}
		}
		int p = x1+1, q = y1;
		if( x1+1 <= x2-1 && y1+1 <= y2-1 && (a[p][q] & 1) ) {
			a[p][q] ^= 1;
			a[p][q+1] ^= 1;
			ans.push_back(node(p, q, p, q+1));
		}
		x1++, x2--, y1++, y2--;
	}
	printf("%d\n", ans.size());
	for(int i=0;i<ans.size();i++)
		printf("%d %d %d %d\n", ans[i].a, ans[i].b, ans[i].c, ans[i].d);
}

Measured memory_bytes: 5232
#include <iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>

using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    int K;
    int A;
    vector<int> sum(M,0);
    for(int i=0;i<N;i++){
        cin >> K;
        for(int j=0;j<K;j++){
            cin >> A;
            sum[A-1]+=1;
        }
    }
    int count=0;
    for(int i=0;i<M;i++){
        if(sum[i]==N){
            count+=1;
        }
    }
    cout << count << endl;
    return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;
    cin >> s;
    for (int i=0;i<s.size();i++)
        s[i]='x';
    cout << s;
}


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

using namespace std;

int main() {
  string S;
  cin >> S;
  unordered_set<char> C(S.begin(), S.end());
  if (S.length() == C.size()) {
    printf("yes\n");
  } else {
    printf("no\n");
  }
  return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    gearup;
    ll n,c,k;cin>>n>>c>>k;
    vl t(n);
    rep(i,n)cin>>t[i];
    sort(all(t));
    ll cap = 1,res = 1,now = t[0];
    rep1(i,n){
        ll time = t[i] - now;
        cap++;
        if(time > k || cap > c){
            cap = 1;
            res++;
            now = t[i];
        }
    }
    out(res);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  long long N,K;
  cin >> N >> K;
  
  vector<long long>A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  
  long long count = 0;
  long long now = 1;
  vector<long long>B(200000,0);
  B[0] = 1;
  long long loop = 0;
  long long begin = 0;
  
  while(count <= K){
      now = A[now - 1];
      count++;
      if(B[now - 1] == 0){
          B[now - 1] = count;
      }
      else{
          loop = count - B[now - 1];
          begin = B[now - 1];
          if(now == 1){
              loop++;
              begin--;
          }
          break;
      }
  }
  long long k_now;
  K -= begin;
  if(loop != 0) K %= loop;
  if(loop != 0)  k_now = now;
  else k_now = 1;
  for(long long i=0;i<K;i++){
      k_now = A[k_now - 1];
  }
  cout << k_now << endl;
  
  return 0;
}


Measured memory_bytes: 6428
#include <stdlib.h>
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#define ll long long
const int INF=0x3f3f3f3f;
#define mod 1000000007
using namespace std;
//priority_queue
int a[103],sum[103];
int Min=0x3f3f3f3f;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i],sum[i]=sum[i-1]+a[i];
    for(int i=1;i<n;i++)
        Min=min(Min,abs(sum[i]-(sum[n]-sum[i])));
    cout<<Min;
}


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

int main(){
    long long X;
    cin >> X;

    bool even = false;

    while(even == false){
        int count = 2;

        for (int i = 2; i < X; i++){
            if (X % i == 0){
                break;
            }
            else {
                count++;
            }
        }
        if (count == X){
            even = true;
        }
        else {
            X += 1;
        }
    }

    cout << X << endl;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  console.log(Math.pow(Number(input.split('\n')[0]), 3));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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


void solve(long long H, long long N, std::vector<long long> A, std::vector<long long> B){
    long long dp[N+1][H+1];
    for(int i=0;i<N+1;i++){
        for(int j=0;j<H+1;j++){
            dp[i][j] = 1000000000;    
        }
    }
    for(int i=0;i<N+1;i++){
        dp[i][0] = 0;
    }
    // for(int i=0;i<N+1;i++){
    //     for(int j=0;j<=H;j++){
    //         cerr<<"i="<<i<<"j="<<j<< "val=" <<dp[i][j] << endl;
    //     }
    // }
    for(int i=0;i<N;i++){
        for(int j=0;j<H+1;j++){
            if(j-A[i]<=0){
                dp[i+1][j] = min(dp[i][j],dp[i][0] +B[i]);
                // cerr<<"minus" << endl;
                // cerr<<"i="<<i<<"j="<<j<< "val=" <<dp[i+1][j] << endl;
                continue;
            }
            dp[i+1][j] = min(dp[i][j],dp[i+1][j-A[i]]+B[i]);
            // cerr<<"i="<<i<<"j="<<j<< "val=" <<dp[i+1][j] << endl;
        }
    }
    cout << dp[N][H] << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
    scanf("%lld",&H);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(H, N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 78464
#include<stdio.h>
#define X 1001
int main(){
	int a,b,c,n,i,j;
	int kk[X]={0},ei[X],ej[X],ek[X],er[X];
	while(1){
		scanf("%d%d%d",&a,&b,&c);
		if(a==0 && b==0 && c==0)break;
		for(i=1;i<=a+b+c;i++)kk[i]=2;
		scanf("%d",&n);
		for(j=0;j<n;j++){
			scanf("%d%d%d%d",&ei[j],&ej[j],&ek[j],&er[j]);
			if(er[j]==1)kk[ei[j]]=kk[ej[j]]=kk[ek[j]]=1;
		}
		for(j=0;j<n;j++){
			if(er[j]==0){
				if(kk[ei[j]]==1 && kk[ej[j]]==1)kk[ek[j]]=0;
				else if(kk[ei[j]]==1 && kk[ek[j]]==1)kk[ej[j]]=0;
				else if(kk[ej[j]]==1 && kk[ek[j]]==1)kk[ei[j]]=0;
			}
		}
		for(i=1;i<=a+b+c;i++)printf("%d\n",kk[i]);
	}
	return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int H,W;
ll int L;
char grid[150][150];
int dx[4] = {-1,0,1,0};
int dy[4] = {0,1,0,-1};//N,E,S,W
ll int memo[150][150][4];
int dir,px,py;

int rotate(int a){
	return (a+1)%4;
}
bool inrange(int x,int y){
	return (x>-1&&y>-1&&x<H&&y<W);
}
int main(){
	while(1){
		cin >> H >> W >> L;
		if(H==0&&W==0&&L==0) break;
		REP(i,H){
			string str;
			cin >> str;
			REP(j,str.size()){
				grid[i][j] = str[j];
				if(grid[i][j]=='N'){dir = 0; px = i; py = j; grid[i][j] = '.';}
				if(grid[i][j]=='E'){dir = 1; px = i; py = j; grid[i][j] = '.';}
				if(grid[i][j]=='S'){dir = 2; px = i; py = j; grid[i][j] = '.';}
				if(grid[i][j]=='W'){dir = 3; px = i; py = j; grid[i][j] = '.';}
			}
		}
		ll int step = 0;
		REP(i,150) REP(j,150) REP(k,4) memo[i][j][k] = -1;
		memo[px][py][dir] = 0;
		while(1){
			if(step == L) goto End;
			int nx = px + dx[dir]; int ny = py + dy[dir];
			if(grid[nx][ny]=='.'&&inrange(nx,ny)){
				step++;
				px = nx; py = ny;
				if(memo[px][py][dir]!=-1){
					// cout << px << " " << py << " " << dir << " "<< memo[px][py][dir] << " " << step << endl;
					//a,b,c
					ll int a = step-memo[px][py][dir];
					ll int b = L-step;
					step += a*(b/a);
					if(step == L) goto End;
				}else{
					memo[px][py][dir] = step;
				}
			}
			if(!inrange(nx,ny)||grid[nx][ny]=='#'){
				dir = rotate(dir);
			}
			
		}
End:
		string ans = "NESW";
		cout << px+1 << " " << py+1 << " " <<  ans[dir] << endl;
	}
}

Measured memory_bytes: 1952
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    int i;
    int now;
    int ans;
    
    for(i=0; i<n; i++){
        cin >> a[i];
    };
    now = 0;
    ans = -1;
    for(i=0; i<n; i++){
        now = a[now]-1;
        if(now == 1){
            ans = i + 1;
            break;
        };
    };
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;

bool is_palindrome(int i) {
  stringstream ss;
  ss << i;
  string s = ss.str();
  int left = 0, right = s.length() - 1;
  while (left < right) {
    if (s[left++] != s[right--]) {
      return false;
    }
  }
  return true;
}

int main() {
  int A, B;
  cin >> A >> B;
  int answer = 0;
  for (int i = A; i <= B; i++) {
    if (is_palindrome(i)) {
      answer++;
    }
  }
  cout << answer;

  return 0;
}


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

#define FastRead  ios_base::sync_with_stdio(0);cin.tie(0);
#define endl      "\n"
#define INF       1<<30

typedef long long ll;

int main()
{
    FastRead

    ll n,m;
    bool flag = false;

    cin>>n>>m;

    string s;

    s.append(n,'0');

    s[0] = '1';

    map<ll,char>mp;

    for(ll i=0;i<m;i++)
    {
        ll pos;
        char ch;

        cin>>pos>>ch;

        pos--;

        if(pos==0 and ch!='0' and !flag)
        {
            mp[pos] = ch;
            flag = true;
            continue;
        }

        if(mp[pos]!=ch and mp[pos]!='\0')
        {
            cout<<-1;
            return 0;
        }
        if(pos==0 and ch=='0' and m!=1)
        {
            cout<<-1;
            return 0;
        }
        mp[pos] = ch;
    }

    for(auto it:mp)
    {
        s[it.first] = it.second;
    }

     if(n==1 and mp[0]=='0')
    {
        cout<<0;
        return 0;
    }

    if(n==1 and m==0)
    {
        cout<<0;
        return 0;
    }

    if(s[0]=='0')
        cout<<-1;
    else
        cout<<s;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include <map> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)
 
 
//C++で提出
 
 
 
// string s="AAA";    s.size() =3    (sのサイズ) ...1
// vector <int> a;    配列a(サイズは0) ...2
// a.push_back(10);   配列のサイズが一つ増えて一番後ろに10を代入 ...2
// A.pop_back();   最後の要素が消去される
// sort(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)より前までを小さい順に並び替えてa[0]から代入していく...3
// reverse(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)までを逆の順にしてa[0]から代入していく
// s.substr(3,2)   配列s[3]から2個の文字を抜き出した文字列 (s[3]とs[4]) ...4
// strcmp(s1,s2)  文字列が等しければ0を出力　s1>s2なら1 s1<s2なら-1を出力　C言語用なので配列は、s1[100]にする...5
 
 
 
 
/*
const int MAX = 100;
int main() {
	int N, M;
	string s, t;
	map<string, int> m;
	m["apple"] = 10;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> s;
		m[s]++;
	}
	cin >> M;
	for (int i = 0; i < M; ++i) {
		cin >> t;
		m[t]--;
	}
	
	int max=0;
 
	for (map<string, int>::iterator i = m.begin(); i != m.end(); ++i) {
		if (max < (i->second)) max = i->second;
	}
 
	if (max < 0) cout << "0";
	else cout << max;
 
	return 0;
}
 
*/
 
int main() {
 
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && a != c) cout << "Yes";
	else if (a == c && a != b) cout << "Yes";
	else if (c == b && a != c) cout << "Yes";
	else cout << "No";
 
 
 
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int K = Integer.parseInt(line[0]);
        int T = Integer.parseInt(line[1]);
        
        line = br.readLine().split(" ");
        int maxCake = 0;
        for(int i=0;i<T;i++){
        	int cake = Integer.parseInt(line[i]);
        	if(cake>maxCake) maxCake=cake;
        }
        int answer = maxCake - 1 - (K-maxCake);
        //separate by the other cakes
        if(answer>0) System.out.println(answer);
        else  System.out.println(0);
    }
}

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

using namespace std;

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

    string n;
    string k;

    cin >> n;
    cin >> k;
    bool ans = true;
    for(int i=0; i< n.length(); ++i){
        if(n[i] != k[i]){
            ans = false;
            break;
        }
    }
    if(ans){
        cout << "Yes";
    }else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
using namespace std;
 
const int maxN = 1e2+10;
int a, b, c, d, cnt[maxN];
 
int main()
{
    cin >> a >> b >> c >> d;
    for (int i=a; i < b; i++) cnt[i]++;
    for (int i=c; i < d; i++) cnt[i]++;
    int ans = 0;
    for (int i=0; i <= 100; i++) ans += (cnt[i] == 2);
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
vector<vector<int>> G;
vector<int> dp, sum, co;
void build(int i, int p) {
    for (auto &e : G[i]) {
        if (e == p) {
            continue;
        }
        build(e, i);
        sum[i] += dp[e];
        co[i] += (dp[e] == 0);
    }
    dp[i] = sum[i] + max(0, co[i] - 1);
}
int ans;
void calc(int i, int p) {
    // cout << i << " " << dp[i] << endl;
    chmin(ans, dp[i] + 1);
    for (auto &e : G[i]) {
        if (e == p) {
            continue;
        }
        int tdi = dp[i];
        int nsum = sum[i] - dp[e];
        int nco = co[i] - (dp[e] == 0);
        dp[i] = nsum + max(0, nco - 1);
        sum[e] += dp[i];
        co[e] += (dp[i] == 0);
        dp[e] = sum[e] + max(0, co[e] - 1);
        calc(e, i);
        dp[i] = tdi;
    }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    G.resize(n);
    dp.resize(n);
    sum.resize(n);
    co.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    build(0, -1);
    ans = INF;
    calc(0, -1);
    cout << ans << endl;
}

Measured memory_bytes: 14592