akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
signed main()
{
    fast;
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    map<string,int> mp;
    mp[s] = a;
    mp[t] = b;
    string u;
    cin>>u;
    mp[u]--;
    cout<<mp[s]<<" "<<mp[t];
}   

Measured memory_bytes: 256
eval"N,C,*D="+`dd`.split*?,
r=*0...C
s,t,u=(0...N*N).group_by{|i|(i/N+i%N)%3}.map{|_,v|r.map{|t|s=0;v.map{|f|s+=D[~-D[~f]*C+t]};s}}
p N<2?0:r.permutation(3).map{|x,y,z|s[x]+t[y]+u[z]}.min

Measured memory_bytes: 70336
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)
//Map<String, Integer> map = new HashMap<String, Integer>(n);
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")

public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	static int Y,N;
	public static void main(String[] args) {
	int ans=0;
	int A=sc.nextInt();
	int B=sc.nextInt();
	int C=sc.nextInt();
	//String S=sc.next();
	/*for(int i=0;i<N;i++) {
		
	}*/
	//if() {}
	
	p(C+" "+A+" "+B);
	
	}
}


Measured memory_bytes: 22612
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.next();
        int len = line.replaceAll("0", "").length();

        System.out.println(len);
    }
}


Measured memory_bytes: 21844
//
//AtCoder Beginner Contest 136
//B - Uneven Numbers
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n;
    cin >> n;

    int ans = 0;
    FOR(i,1,n) if ((to_string(i).size()%2)==1) ans++;

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


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<char> c(n);
    for (int i = 0; i < n; i++) cin >> c[i];

    vvll dp(n + 1, vll(n + 1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= n; j++) {
            if (i + 1 < j) break;
            if (c[i] == '-') {
                if (j + 1 <= n) {
                    dp[i + 1][j + 1] += dp[i][j];
                    if (dp[i + 1][j + 1] >= MOD) dp[i + 1][j + 1] -= MOD;
                }
            } else if (c[i] == 'U') {
                dp[i + 1][j] += dp[i][j];
                if (dp[i + 1][j] >= MOD) dp[i + 1][j] -= MOD;
                if (j + 1 <= n) {
                    dp[i + 1][j + 1] += dp[i][j] * (i - j) % MOD;
                    if (dp[i + 1][j + 1] >= MOD) dp[i + 1][j + 1] -= MOD;
                }
            } else {
                if (j + 1 <= n) {
                    dp[i + 1][j + 1] += dp[i][j] * (i - j) % MOD;
                    if (dp[i + 1][j + 1] >= MOD) dp[i + 1][j + 1] -= MOD;
                }
                if (j + 2 <= n) {
                    dp[i + 1][j + 2] += dp[i][j] * (i - j) * (i - j) % MOD;
                    if (dp[i + 1][j + 2] >= MOD) dp[i + 1][j + 2] -= MOD;
                }
            }
        }
    }
    cout << dp[n][n] << '\n';
    return 0;
}



Measured memory_bytes: 3260
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=200005;
const int mod=1e9+7;
ll a[N],suf[N];
int n;
int main(){
  scanf("%d",&n);
  for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
  for(int i=n;i>=1;i--)suf[i]=(suf[i+1]+a[i])%mod;
  long long ans=0;
  for(int i=1;i<=n;i++){
    ans=(ans+a[i]*suf[i+1])%mod;
  }
  printf("%lld\n",ans);
  return 0;
} 


Measured memory_bytes: 6936
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
const ll limit = 2e9;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);	
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};



int main()
{	
	ll t, a, k; cin>> t >> a >> k;
	if(k <= t){
		cout<< t-k<<" "<< a<<endl; 
	}
	else{
		k = -(t - k);
		if(k <= a)
			cout<< 0<<" "<<a - k;
		else 
			cout<< 0 <<" "<<0;
	}
	return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);


    /*
     * AtCoder Beginner Contest 074 D - Restoring Road Network　
     */
    // ワ―シャルフロイドで最短経路更新が出来たらそれは最短経路の図じゃないのであうと
    // えー、わかんね。最小全域木出してゴリ押すか->ダメそう
    int n; cin >> n;
    vec<vll> warshall(n, vll(n));
    rep(i,n)rep(j,n) cin >> warshall[i][j];

    rep(k,n)rep(i,n)rep(j,n) {
        if(warshall[i][j] > warshall[i][k] + warshall[k][j]) {
            cout << -1 << '\n';
            return 0;
        }
    }

    ll ans = 0;

    for(int i = 0; i < n-1; ++i) {
        for(int j = i+1; j < n; ++j) {
            bool can = 1;
            rep(k, n) {
                if(k==i || k==j) continue;
                if(warshall[i][j] == warshall[i][k] + warshall[k][j]) can = 0;
            }
            if(can) ans += warshall[i][j];
        }
    }

    cout << ans << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 1024
#include <stdio.h>
#define N 100000
int a[N+1];
int dp[N+1];

int min(int a, int b){
  if(b>a)return a;
  else return b;
}
int abs(int a){
  if(a<0)return -1*a;
  else return a;
}
int main(){
   int i,j, n;
   scanf("%d", &n);
   for(i=0;i<n;i++)scanf("%d", &a[i]);
   dp[0]=0;

   for(i=1;i<n;i++){
     if(i==1)dp[i]=dp[0]+abs(a[i]-a[i-1]);
     else{
       dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
     }
   }

   printf("%d\n", dp[n-1]);


   return 0;
 }


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(src,dst)    for(int i=src; i<dst;  i++)
#define rep2(src,dst)   for(int j=src; j<dst;  j++)
#define INF 1000000000000 //1e+12
#define MOD 10000007 //1e9+7
#define PI  acos(-1)
#define ll long long
template<typename T> inline void ChMin(T* a, T* b) {if(*a>*b) *a=*b;}
template<typename T> inline void ChMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  DivUp(T a, T b)   {return ((a+b-1)/b);}

int main(){
    int a, b; cin >> a >> b;
    cout << 6-a-b << endl;
}
/*

*/


Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int a[200100];
int b[100100],c[100100];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int i,j,k,m,n;
    int bb=0,cc=0;
    cin>>n;
    for(i=1; i<=n; i++)
        cin>>a[i];
    if(n%2==0)
    {
        for(i=2; i<=n; i++)
        {
            if(i%2==0)
            {
                b[++bb]=a[i];
            }
            else
                c[++cc]=a[i];
        }
    }
    else
    {
        for(i=2; i<=n; i++)
        {
            if(i%2!=0)
            {
                b[++bb]=a[i];
            }
            else
                c[++cc]=a[i];
        }
    }
    for(i=bb; i>=1; i--)
        cout<<b[i]<<' ';
    cout<<a[1]<<' ';
    for(i=1; i<cc; i++)
        cout<<c[i]<<' ';
    if(cc)
        cout<<c[cc]<<endl;
    return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

int n;
vec<int> v;

bool bin(int key) {
   int left = 0, right = n - 1;
   while (left <= right) {
      int mid = (left + right) / 2;
      // printf("(%d, %d, %d)\n", left, right, mid);
      if (key < v[mid]) {
         right = mid - 1;
      } else if (key > v[mid]) {
         left = mid + 1;
      } else {
         return true;
      }
   }
   return false;
}

int main() {
   cin >> n;
   rep (i, 0, n) {
      int x;
      cin >> x;
      v.push_back(x);
   }
   sort(all(v));

   int q;
   cin >> q;
   int cnt = 0;
   rep (i, 0, q) {
      int x;
      cin >> x;
      if (bin(x)) cnt++;
   }
   cout << cnt << endl;

   return 0;
}


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

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

    ll N;
    cin >> N;
    ll ans = 0;
    rep(i, N+1) {
        if(i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
import heapq

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

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

e = []

# AxB を取得
for va in a:
    for vb in b:
        heapq.heappush(e, -(va+vb))

# AxB は 大きい方から最大k個のみ使う
d = []
ite = min(k, len(e))

# AxB[k個] x C を取得
for i in range(ite):
    ve = -heapq.heappop(e)
    for vc in c:
        heapq.heappush(d, -(ve+vc))

for i in range(k):
    print(-heapq.heappop(d))


Measured memory_bytes: 162172
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s;
  cin >> s;
  int count = 0;
  rep(i,3) {
    if(s[i] == 'o') count++;
  }
  cout << 700 + 100 * count << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
#define endl '\n'
#define F first
#define S second
const int MAX_N=3e2+3;

int n;
double dp[MAX_N][MAX_N][MAX_N];
int cnt[2];

int main()
{
	for(int i=0;i<MAX_N;i++) for(int j=0;j<MAX_N;j++) for(int k=0;k<MAX_N;k++)
	{
		double tot=i+j+k;
		if(i) dp[i][j][k]+=i/tot*dp[i-1][j+1][k];
		if(j) dp[i][j][k]+=j/tot*dp[i][j-1][k+1];
		if(k&&tot-1) dp[i][j][k]+=k/tot*dp[i][j][k-1]/(tot-1)*tot;
		dp[i][j][k]+=1;
	}
	scanf("%d",&n);
	for(int i=0,t1;i<n;i++)
	{
		scanf("%d",&t1);
		cnt[t1-1]++;
	}
	printf("%.12lf\n",dp[cnt[2]][cnt[1]][cnt[0]]);
	return 0;
}



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

//#define DEBUG 1

//#define int long long
#define for0(i,n) for (int i=0; i<n; i++)
#define iter(c) for(auto it=c.begin(); it!=c.end(); it++)
#define iter2(c) for(auto it2=c.begin(); it2!=c.end(); it2++)
#define pb push_back
#define ms(a,z) memset(a,z,sizeof(a));
#define mp make_pair
#define X first
#define Y second
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define all(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define pmod(x,m) (((x)%(m)+m)%m)
#ifdef int
#define read(x) scanf("%lld",&x);
#else
#define read(x) scanf("%d",&x);
#endif

#ifdef DEBUG
#define nl cout<<"\n";
#define pr(x) cout<<(x)<<" ";
#define prl(x) cout<<#x " = "<<x<<endl;
#define prp(x) cout<<"("<<(x).first<<" "<<(x).second<<") ";
#define printv(v) {for(int _=0; _<sz(v); _++) cout<<v[_]<<" "; cout<<"\n";}
#define printa(a,s) {for (int _=0; _<s; _++) cout<<a[_]<<" "; cout<<"\n";}
#define print2D(a,m,n) {for (int _=0; _<m; _++) {for (int __=0; __<n; __++) cout<<a[_][__]<<" "; cout<<"\n";} cout<<"\n";}
#define priter(v) iter(v) {pr(*it)} nl
#define debug cout<<"ok at line "<<__LINE__<<endl;
#else
#define nl
#define pr(x)
#define prl(x)
#define prp(x)
#define printv(v)
#define printa(a,s)
#define print2D(a,m,n)
#define priter(v)
#define debug
#endif
#define MAXN 100000

using namespace std;

typedef long long ll;

const int INF = 2147483647;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;

int32_t main()
{
    #ifdef DEBUG
    //freopen("B.txt","r",stdin);
    //freopen("","w",stdout);
    #endif

    int n;
    cin >> n;
    if (n == 3) {
        cout<<"2 5 63"<<endl;
    }
    else {
        set<int> s;
        s.insert(2);
        s.insert(3);
        s.insert(4);
        s.insert(9);
        n -= 4;
        int x;
        for (x=6; x<=30000 and n>0; x+=6,n--)
            s.insert(x);
        for (x=8; x<=30000 and n>0; x+=6,n-=2) {
            s.insert(x);
            s.insert(x+2);
        }
        for (x=15; x<=30000 and n>0; x+=12,n-=2) {
            s.insert(x);
            s.insert(x+6);
        }
        if (n == -1) {
            s.erase(30000);
        }
        
        for (int x : s) {
            cout<<x<<" ";
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 1280
N, M = map(int, input().split())
if N==1 and M==0:
  print(0)
  import sys
  sys.exit()
ans = [-1]*N
for i in range(M):
  s,c = map(int,input().split())
  if ans[s-1]!=-1 and ans[s-1]!=c:
    print(-1)
    break
  ans[s-1] = c
else:
  for i in range(N):
    if ans[i]==-1:
      if i!=0:
        ans[i] = 0
      else:
        ans[i] = 1
    ans[i] = str(ans[i])
  a = ''.join(ans)
  if a[0]=='0' and len(a)>1:
    print(-1)
  else:
    print(a)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
const int M=300000;//M=1e6+100;
typedef long long int ll;
using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s,t,u;
	int a,b;
	cin>>s>>t>>a>>b>>u;
	if(s==u)
	{
		cout<<a-1<<" "<<b;
	}else cout<<a<<" "<<b-1;
	
}
	

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

using namespace std;
typedef long long ll;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define repb(i,a,b)         for(ll i=a;i>=b;i--)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define tr(c,it)            for(auto const &it : c)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define sz(c)               (c).size()
#define all(c)              (c).begin(),(c).end()
#define sl(a)               scanf("%lld",&a);
#define TH                  1000
#define F                   first
#define S                   second
#define pi                  3.14159265359
ll INF=1e18+10;
ll MOD=1e9+7;

const int N=3*(1e5)+5;
vector <int> adj[N];
bool vis[N];
int lev[N];

void bfs(int s)
{
    vis[s]=true;
    queue <int> q;
    lev[s]=0;
    q.push(s);
    while(!q.empty())
    {
        int now=q.front();
        q.pop();
        for(auto to : adj[now])
        {
            if(!vis[to])
            {
                vis[to]=true;
                lev[to]=lev[now]+1;
                q.push(to);
            }
        }
    }
}

int main()
{
    int n,m;
    cin>>n>>m;
    rep(i,0,m)
    {
        int a,b;
        cin>>a>>b;
        adj[a].pb(b+n);
        adj[a+n].pb(b+2*n);
        adj[a+2*n].pb(b);
    }

    int s,t;cin>>s>>t;
    bfs(s);
    if(lev[t]%3==0 && lev[t])
        cout<<(lev[t]/3);
    else
        cout<<-1;
}


Measured memory_bytes: 18176
n=int(input())

import math

def gcd_(lis):
    ans=lis[0]
    for i in  lis[1:]:
        ans=math.gcd(ans,i)
    return ans

ans=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            ans+=gcd_([i,j,k])
print(ans)

Measured memory_bytes: 68764
#include<iostream>
int main(){
	int a,b;
	while(std::cin>>a>>b){
		int n=a+b;
		if(n<10)std::cout<<1<<std::endl;
		else if(n<100)std::cout<<2<<std::endl;
		else if(n<1000)std::cout<<3<<std::endl;
		else if(n<10000)std::cout<<4<<std::endl;
		else if(n<100000)std::cout<<5<<std::endl;
		else if(n<1000000)std::cout<<6<<std::endl;
		else if(n<10000000)std::cout<<7<<std::endl;
		else if(n<100000000)std::cout<<8<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import sys
from collections import defaultdict
sys.setrecursionlimit(1000000)

N,M=map(int, sys.stdin.readline().split())
A=[ map(int, sys.stdin.readline().split()) for i  in range(M) ] 

par=[ i for i in range(N+1) ]

size=[ 1 for i in range(N+1) ]

def root(x):
	if par[x]==x:
		return x
	else:
		par[x]=root( par[x] )
		return par[x]

def same(x,y):
	return root(x)==root(y)

def unite(x,y):
	x=root(x)
	y=root(y)
	if x==y: return
	par[x]=y
	size[y]+=size[x]

def getsize(x):
	return size[root(x)]


ans=N*(N-1)/2

L=[]

for a,b in reversed(A):
	L.append(max(0,ans))
	if root(a)==root(b):
		n1=getsize(a)
		ans+=n1*(n1-1)/2	
	else:
		n1=getsize(a)
		n2=getsize(b)
		ans+=n1*(n1-1)/2
		ans+=n2*(n2-1)/2

	unite(a,b)

	n=getsize(a)
	ans-=n*(n-1)/2



for x in reversed(L):
	print x


Measured memory_bytes: 359132
#include <bits/stdc++.h>
using namespace std;
#define fst first
#define sec second
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
const ll INF=1LL<<63-1,MOD=1e9+7;
const int N=1<<17;

ll c[4],n;

int main(){
	ios::sync_with_stdio(false);
	cin>>c[0]>>c[1]>>c[2]>>c[3]>>n;
	c[0]*=8;c[1]*=4;c[2]*=2;
	ll cost=0;
	if(n%2){
		cost+=min(c[0],min(c[1],c[2]))/2;
		n--;
	}
	n/=2;
	ll rest=min(min(c[0],c[3]),min(c[1],c[2]));
	cout<<rest*n+cost;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<ll,pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main(){
    int a, b;
    char op;
    cin >> a >> op >> b;
    cout << (op == '+' ? a+b : a-b) << endl;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;cin>>N;
  llvec A(N);
  priority_queue<ll> q;
  rep(i, N){
    cin >> A[i];
    q.push(A[i]);
  }

  rep(i, N){
    ll iq = q.top();
    q.pop();
    if(iq == A[i]){
      ll iq2 = q.top();
      q.pop();
      q.push(iq);
      iq = iq2;
    }
    cout << iq << endl;
    q.push(iq);
  }
  return 0;
}


Measured memory_bytes: 4848
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,k=2,s=1;
vector<int>v[N];
int main()
{
    scanf("%d",&n);
    v[1].push_back(1);
    v[2].push_back(1);
    while(s<n)
    {
        for(int i=s+1,j=1;i<=s+k;i++,j++)
        {
            v[k+1].push_back(i);
            v[j].push_back(i);
        }
        s+=k;
        k++;
    }
    if(s>n) printf("No\n");
    else
    {
        printf("Yes\n");
        printf("%d\n",k);
        for(int i=1;i<=k;i++)
        {
            printf("%d",v[i].size());
            for(int j=0;j<v[i].size();j++)
                printf(" %d",v[i][j]);
            printf("\n");
        }
    }
}


Measured memory_bytes: 7040
#include<stdio.h>
int main(){
  int n,i,j,min,b,c=0;
  scanf("%d",&n);
  if(n<0||n>100)return 0;
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    min=i;
    for(j=i;j<n;j++){
      if(a[j]<a[min])min=j;
    }
    if(a[i]==a[min]);
    else{b=a[i];
    a[i]=a[min];
    a[min]=b;
    c++;}
  }
  for(i=0;i<n;i++){
    if(i==n-1)printf("%d\n",a[i]);
    else printf("%d ",a[i]);
    }
  printf("%d\n",c);
  return 0;
}



Measured memory_bytes: 2084
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
int main(){
  int N;
  cin>>N;
  int h[200000];
  for(int i=0;i<N;i++) cin>>h[i];
  pair<int,pair<long long,int>> flo[200001];
  for(int i=0;i<N;i++){
    long long a; cin>>a;
    flo[i]=make_pair(h[i],make_pair(a,i));
  }
  sort(flo,flo+N);
  flo[N]=make_pair(N+1,make_pair(0,N));
  long long tree[1000000];
  int l=1;
  while(l<N+1) l*=2;
  for(int i=1;i<l*2;i++) tree[i]=0;
  for(int i=0;i<=N;i++){
    int x=flo[i].second.second;
    long long v=0;
    int n=l+x;
    while(n!=0){
      v=max(v,tree[n]); n/=2;
    }
    tree[l+x]=flo[i].second.first+v;
    int L=l+x+1; int R=l*2-1;
    while(R-L>0){
      if(L%2==0){
        L/=2;
        if(R%2==0){
          tree[R]=max(tree[R],tree[l+x]); R=(R-1)/2;
        }
        else R/=2;
      }
      else{
        tree[L]=max(tree[L],tree[l+x]); L=(L+1)/2;
        if(R%2==0){
          tree[R]=max(tree[R],tree[l+x]); R=(R-1)/2;
        }
        else R/=2;
      }
    }
    if(L==R) tree[L]=max(tree[L],tree[l+x]);
  }
  cout<<tree[l+N]<<endl;
  
  return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  string S;
  cin >> S;
  // 最終状態は0101...か1010...のどちらかのみ
  string s1 = "", s2 = "";
  REP(i, S.length())
  {
    s1 += (i & 1 ? "0" : "1");
    s2 += (i & 1 ? "1" : "0");
  }
  int ans1 = 0, ans2 = 0;
  REP(i, S.length())
  {
    ans1 += (S[i] == s1[i] ? 0 : 1);
    ans2 += (S[i] == s2[i] ? 0 : 1);
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}

Measured memory_bytes: 768
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define MX 100000

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> cnt_mod(m, 0);
  vector<int> cnt(MX+1,0);
  rep(i,n){
    int d;
    scanf("%d", &d);
    cnt_mod[d%m]++;
    cnt[d]++;
  }

  int res=cnt_mod[0]/2; //mでわってあまり0
  if(m%2==0) res += cnt_mod[m/2]/2; //偶数なら

  repl(i,1,(m+1)/2){
    // mod i, mod m-i のくみ
    int mn = min(cnt_mod[i], cnt_mod[m-i]);
    res += mn;
    // mod iのほう
    if(cnt_mod[i]>mn){
      int same=0, no=0;
      for(int k=i; k<=MX; k+=m){
        same += cnt[k]/2;
        no += cnt[k]%2;
      } //cout<<mn<<" "<<no<<" "<<same<<endl;
      if(mn>=no && same>0) res += (2*same-(mn-no))/2;
      else if(same>0) res += same;
    }

    // mod m-iのほう
    else if(cnt_mod[m-i]>mn){
      int same=0, no=0;
      for(int k=m-i; k<=MX; k+=m){
        same += cnt[k]/2;
        no += cnt[k]%2;
      } //cout<<mn<<" "<<no<<" "<<same<<endl;
      if(mn>=no && same>0) res += (2*same-(mn-no))/2;
      else if(same>0) res += same;
    }
  }

  cout << res<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
string solve(int a, int b, int c) {
  bool flag = false;
  if (a == 0) {
    flag = true;
    a = b;
    b = c;
    c = 0;
  }
  string res = "";
  if (a == 0) {
    res = string(b, 'b');
  } else {
    if (b == 0 && c == 0) {
      res = string(a, 'a');
    } else {
      vector<string> put(a, "a");
      for (int i = 0; i < c; i++) {
        put[i % a] += 'c';
      }
      int ptr = c % a;
      for (int i = 0; i < b; i++) {
        put[ptr] += 'b';
        ptr++;
        if (ptr == a) {
          ptr = c % a;
        }
      }
      map<string, int> mp;
      for (auto &s : put) {
        mp[s]++;
      }
      vector< pair<string, int> > v;
      for (auto &p : mp) {
        v.push_back(p);
      }
      assert(v.size() <= 3);
      while (v.size() < 3) {
        v.emplace_back("", 0);
      }
      string aux = solve(v[0].second, v[1].second, v[2].second);
      res = "";
      for (int i = 0; i < (int) aux.size(); i++) {
        res += v[aux[i] - 'a'].first;
      }
    }
  }
  if (flag) {
    for (char &c : res) {
      c++;
    }
  }
  return res;
}
 
int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  cout << solve(a, b, c) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
#define ld long double
int inf=100000000;
ll INF=4000000000000000000;
ll MOD=1000000007;


int main() {
   ll n;
   cin >> n;
   vector<ll> a(n),b(n);
   rep(i,n) cin >> a.at(i);
   ll t=a.at(0)*2;
   rep(i,n){
       if (i!=n-1){
           b.at(i+1)=t;
           t=(a.at(i+1)-t/2)*2;
       }
       if (i==n-1){
           b.at(0)=t;
       }
   }
   ll y;
   y=t/2;
   rep(i,n){
       if (i!=n-1){
           if (i%2==0) b.at(i+1)-=y;
           else b.at(i+1)+=y;
       }
       if (i==n-1){
           b.at(0)-=y;
       }
   }
   rep(i,n-1) cout << b.at(i) << " ";
   cout << b.at(n-1) << endl;
}


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

int main() {

  int H,N;
  cin >> H >> N;
  
  vector<int> A(N); // int型の配列変数vecを宣言
  int SUM=0;
  for (int i = 0; i < N; i++) {
    	cin >> A.at(i) ;
		SUM = SUM + A.at(i);
  }
  string ANS="No";
  if (SUM >= H){
	ANS = "Yes";
  }
  	
  cout << ANS << endl;
}

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

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; i++)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; i--)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') ch = getchar(), f = -1;
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> void out(Tp x) {
	if (x > 9) out(x / 10);
	putchar(x % 10 + '0');
	return;
}

template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}
template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}

const int MAXN = 200010;

struct Obj {
	int L, R;
} num[MAXN];

int n, m;
int maxx[MAXN << 2], tag[MAXN << 2];

bool cmp(const Obj &x, const Obj &y) {return x.L < y.L || x.L == y.L && x.R < y.R;}

void build(int now, int l, int r)
{
	if (l == r) {
		maxx[now] = -(m - (l - 1) + 1);
		return;
	}
	int mid = (l + r) >> 1;
	build(now << 1, l, mid); build(now << 1 | 1, mid + 1, r);
	maxx[now] = Max(maxx[now << 1], maxx[now << 1 | 1]);
}

void pushdown(int now)
{
	if (!tag[now]) return;
	maxx[now << 1] += tag[now]; tag[now << 1] += tag[now];
	maxx[now << 1 | 1] += tag[now]; tag[now << 1 | 1] += tag[now];
	tag[now] = 0;
}

void modify(int now, int l, int r, int x, int y, int z)
{
	if (x <= l && r <= y) {
		maxx[now] += z; tag[now] += z; return;
	}
	pushdown(now);
	int mid = (l + r) >> 1;
	if (x <= mid) modify(now << 1, l, mid, x, y, z);
	if (mid < y) modify(now << 1 | 1, mid + 1, r, x, y, z);
	maxx[now] = Max(maxx[now << 1], maxx[now << 1 | 1]);
}

int query(int now, int l, int r, int x, int y)
{
	if (x <= l && r <= y) return maxx[now];
	pushdown(now);
	int mid = (l + r) >> 1;
	if (y <= mid) return query(now << 1, l, mid, x, y);
	if (mid < x) return query(now << 1 | 1, mid + 1, r, x, y);
	return Max(query(now << 1, l, mid, x, y), query(now << 1 | 1, mid + 1, r, x, y));
}

using std::vector;

vector<int>V[MAXN];

int main()
{
	in(n); in(m);
	FOR(i, 1, n) {
		in(num[i].L), in(num[i].R);
		V[num[i].L].push_back(num[i].R);
	}

	build(1, 1, m + 2);

	int he = n - m;
	
	FOR(i, 0, m) {
		for (int j = 0; j < V[i].size(); j++) {
			modify(1, 1, m + 2, 1, V[i][j] + 1, 1);
		}
		chkmax(he, query(1, 1, m + 2, i + 2, m + 2) - i);
	}

	assert(he >= 0);
	printf("%d\n", he);
	
	return 0;
}


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

int main()
{
	int i, x, y, count;
	x = 0;
	y = 0;
	count = 0;
	int hairetu[6000];
	while (count < 6000)
	{
		cin >> x >> y;
		if ((x >= 0) && (x <= 10000) && (y >= 0) && (y <= 10000)) //x,y共に0から10000の時
		{
			if (x == 0 && y == 0)
			{
				break;    // 
			}

			if (x > y)    // xがｙより大きいとき
			{
				hairetu[count] = y;
				hairetu[count + 1] = x;  //yを先に格納する
				count = count + 2;
			}
			else
			{
				hairetu[count] = x;
				hairetu[count + 1] = y; //xを先に格納する
				count = count + 2;
			}


		}

	}
	for (i = 0; i < count; i = i + 2)
	{
		cout << hairetu[i] << " " << hairetu[i + 1] << endl;  //配列の要素を2つずつ1行に表示
	}
	return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;

int main(){
  int n;
  ll p=1, mod=1000000007;

  cin>>n;
  for(int i=1; i<=n; i++){
    p *= i;
    p %= mod;
  }
  cout<<p<<endl;
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.chomp.split.map {|s| s.to_i }

num = 1
p = a.shift
asc = nil

until a.empty?
  if asc.nil?
    asc = p < a[0] if p != a[0]
  end
  
  if asc
    if p > a[0]
      asc = nil
      num += 1
    end
  else
    if p < a[0]
      asc = nil
      num += 1
    end
  end
  p = a.shift
end

puts num

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 2; i < n; i++) {
    if (s[i] == 'C' && s[i-1] == 'B' && s[i-2] == 'A') {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int a[n];
    int minv = INF;
    int maxv = MIN;
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];
        minv = min( minv, a[i]);
        maxv = max( maxv, a[i]);
    }

    int ans = INF;
    for( int i = minv; i <= maxv; ++i ) {
        int tmp = 0;
        for( int j = 0; j < n; ++j ) {
            tmp += ( i - a[j] ) * ( i - a[j] );
        }

        ans = min( ans, tmp );
    }

    cout << ans << endl;
    return 0;

}


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


int main()
{
    int taro = 0;
    int hana = 0;
    int n;
    std::cin >> n;
    for(int i = 0; i < n; i++){
        std::string t;
        std::string h;
        std::cin >> t >> h;
        if(t < h){
            hana += 3;
        }else
        if(t > h){
            taro += 3;
        }else{
            hana += 1;
            taro += 1;
        }
    }
    std::cout << taro << " " << hana << std::endl;
    return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define endl "\n"
#define int long long
#define test int t; cin>>t; while(t--)
#define debug(x) cout<<#x<<" "<<(x)<<endl
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int N=1e5;
signed main()
{
	fastio
	//test
	{
        int n; cin>>n;
        set<string> s;
        for(int i=0;i<n;i++)
        {
        	string dum; cin>>dum;
        	s.insert(dum);
        }
        cout<<s.size();
  	}
}

Measured memory_bytes: 19248
#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()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct SCC{
    int V;
    vector<vector<int>> G, rG;
    vector<int> vs; // 帰りがけ順の並び
    vector<int> cmp; //属する強連結成分トポロジカル順序
    vector<bool> used;

    SCC(){}
    SCC(int n){
        V = n;
        G = vector<vector<int>>(n);
        rG = vector<vector<int>>(n);
    }

    void add_edge(int from, int to){
        G[from].push_back(to);
        rG[to].push_back(from);
    }

    void dfs(int v){
        used[v] = true;
        rep(i,G[v].size())if(!used[G[v][i]]) dfs(G[v][i]);
        vs.push_back(v);
    }

    void rdfs(int v, int k){
        used[v]=true;
        cmp[v]=k;
        rep(i,rG[v].size())if(!used[rG[v][i]]) rdfs(rG[v][i],k);
    }

    int scc(){
        used = vector<bool>(V,false);
        vs.clear();
        rep(i,V)if(!used[i]) dfs(i);

        used = vector<bool>(V,false);
        cmp = vector<int>(V);
        int num_scc = 0;
        for(int i=vs.size()-1; i>=0; --i)if(!used[vs[i]]) rdfs(vs[i],num_scc++);
        return num_scc;
    }
};

const ll mod = 1e9+7;

int main(){
    int n,m;
    scanf(" %d %d", &n, &m);

    SCC s(n);

    vector<int> u(m),v(m);
    rep(i,m){
        scanf(" %d %d", &u[i], &v[i]);
        --u[i];
        --v[i];
        s.add_edge(u[i],v[i]);
    }

    int sz = s.scc();
    vector<vector<int>> dag(sz), r_dag(sz);
    rep(i,m){
        int U = s.cmp[u[i]], V = s.cmp[v[i]];
        if(U != V){
            dag[U].pb(V);
            r_dag[V].pb(U);
        }
    }

    ll ans = 1;
    vector<vector<ll>> dp(sz, vector<ll>(2,1));
    rep(i,sz){
        for(int j:r_dag[i]){
            (dp[i][0] *= dp[j][0]) %= mod;
            (dp[i][1] *= dp[j][0]+dp[j][1]) %= mod;
        }

        // leaf
        if(dag[i].size() == 0){
            (ans *= dp[i][0]+dp[i][1]) %= mod;
        }
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n;
    string s,t;
    cin>>s>>t;
    cout<<t<<s<<endl;
    return  0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int d,t,s;	cin>>d>>t>>s;
	if(d>t*s)	No();
	else Yes();


    return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

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

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

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

  lint ng = 0;
  lint ok = 10000000000;
  while (ok - ng > 1) {
    lint mid = (ok + ng) / 2;
    lint cnt = 0;
    for (int i = 0; i < n; i++) {
      cnt += (a[i] - 1) / mid;
    }
    if (cnt <= k) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;

  return 0;
}


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

int main() {
  int n,a,b,c,d;
  cin >> n;
  a = n / 1000;
  b = (n / 100) % 10;
  c = (n / 10) % 10;
  d = n % 10;
  if (a == b && b == c) {
    cout << "Yes" << endl;
  } else if (b == c && c == d) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector <int> a(100001, 0);
  vector <int> b(100001, 0);
  for (int i = 0; i < n; i++) {
	  int v;
	  cin >> v;
	  if (i % 2==0) {
		  a[v]++;
		} else {
		  b[v]++;
		}
	}
  int ma = 0;
  int na = 0;
  int mb = 0;
  int nb = 0;
  for (int i = 1; i <= 100000; i++) {
	  if (a[i] > a[ma]) {
		  na = ma;
		  ma = i;
		} else if (a[i] > a[na]) {
		  na = i;
		}
	  if (b[i] > b[mb]) {
		  nb = mb;
		  mb = i;
		} else if (b[i] > b[nb]) {
		  nb = i;
		}
	}
  if (ma != mb) {
	  cout << n - a[ma] - b[mb] << endl;
	} else {
	  cout << n - max(a[ma] + b[nb], a[na] + b[mb]) << endl;
	}
  return 0;
}

Measured memory_bytes: 1152
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
 */
//入力終了→Ctrl+D
import java.time.Year;
import java.util.*;
import java.awt.*;
import java.awt.Graphics.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        int[] s=new int[n+1];
        for (int i = 0; i < n; i++) {
            s[i]=sc.nextInt();
        }
        s[n]=Integer.MAX_VALUE;
        int q=sc.nextInt();
        int[] t=new int[q];
        for (int i = 0; i < q; i++) {
            t[i]=sc.nextInt();
        }
        int ans=0;
        for (int i = 0; i < q; i++) {
            int ok=0,ng=n;
            while (abs(ng-ok)>1){
                int m=(ok+ng)/2;
                if(s[m]>t[i]){
                    ng=m;
                }else ok=m;
            }
            if(s[ok]==t[i])ans++;
        }
        out.println(ans);
    }
}


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

int main(){
	
	long A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	long  ans = A*X+B*Y;

	ans = min(C*max(X,Y)*2, ans);

	long  z=0;
	if(X>Y){
		z = C*Y*2 + (X-Y)*A;
	}
	else
	{
		z = C*X*2 + (Y-X)*B;
	}
	ans = min(z, ans);

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

Measured memory_bytes: 256