akhauriyash/Code-Regression huggingface dataset:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append((i, n//i))
    return divisors

def main():
    n = II()
    divisors = make_divisors(n)
    minp = (10**10, 0)
    for a,b in divisors:
        if abs(minp[0]-minp[1]) > abs(a-b):
            minp = (a,b)
    A = len(str(minp[0]))
    B = len(str(minp[1]))
    print(max(A,B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
    using namespace std;
     
    int main()
    {
      int x, mx = 0 , mn = 100000, k;
      for(int i = 0 ; i<5 ; i++){
        cin>>x;
        mn = min(mn,x);
        mx = max(mx, x);
      }
      cin>>x;
      if(mx- mn <= x) cout<<"Yay!"<<endl;
      else cout<<":("<<endl;
      return 0;
    }

Measured memory_bytes: 256
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
     n = int(input())
     ans = 0
     for i in range(1, n+1):
         if i % 3 != 0 and i % 5 != 0:
             ans += i
     print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 72840
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int> v(N);
  for(int i=0;i<N;i++){
  	cin>>v[i];
  }
  sort(v.begin(),v.end());
  int dan=1;
  for(int i=1;i<N;i++){
  	if(v[i]>v[i-1]) dan++;
  }
  cout<<dan<<endl;
}

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

const int N_MAX=4;
vector<char> a(N_MAX);
vector<int> A(N_MAX);

int ctoi(char c) {
	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}

string equation(bitset<3> s){
  string eq;
  eq=eq+a.at(0);
  for(int i=0;i<3;++i){
    if(s.test(i)){
    eq=eq+"+"+a.at(i+1);
    }
    else{
    eq=eq+"-"+a.at(i+1);
    }
  }
  eq=eq+"=7";
  return eq;
}

int main(){
  for(int i=0;i<4;++i){
    cin>>a.at(i);
    A.at(i)=ctoi(a.at(i));
  }  

  bool ans=false;
  for(int tmp=0;tmp<(1<<3);++tmp){
    bitset<3> s(tmp);
    int sum=A.at(0);
    for(int i=0;i<3;++i){
    if(s.test(i)){
      sum=sum+A.at(i+1);
    }
    else{
      sum=sum-A.at(i+1);
    }
  }
  if(sum==7){
    cout<<equation(s)<<endl;
    break;
  }
  }
}

Measured memory_bytes: 256
n, l = map(int, input().split())

# N 個のりんごがあって、それ一つ一つの味はL + i - 1 で表される（i = 1,2,...,n）
# 等差数列の和の公式を利用
total = n * (l + l + n - 1) // 2

# ひとつめのりんごの味はL, N個目のりんごの味はL+N-1
first, last = l, l + n - 1
# 1. 美味しいりんごだけで作る場合、もっともおいしくないりんごなら食べてもいい
if first >= 0:
  taste = total - first
# 2. まずいりんごが混ざっている時、美味しくないしまずくない中間のりんごを食べるべき
elif first < 0 and last >= 0: 
  taste = total - 0
# 3. まずいりんごだけで作る場合、もっともまずくないりんごを食べたほうがいい
else:
  taste = total - last  

print(taste)
# print('taste is ' + str(taste))
# print('total is ' + str(total))
# print('apple is ' + str(total - taste))


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

def next(x):
    if(x==""):
        return "3"
    if(x[-1]=="3"):
        return x[0:-1]+"5"
    if(x[-1]=="5"):
        return x[0:-1]+"7"
    if(x[-1]=="7"):
        return next(x[0:-1])+"3"

cnt=0
a = "3"
while(int(a) <= n):
    if all([c in a for c in "753"]):
        cnt += 1
    a = next(a)

print(cnt)


Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func maxInt(a, b int) int {
	switch {
	case a >= b:
		return a
	default:
		return b
	}
}

func main() {
	var n, k int
	var str string
	fmt.Scan(&n, &k, &str)

	var partLength []int
	prevChar := str[0:1]
	cnt := 1
	for i := 1; i < n; i++ {
		if str[i:i+1] == prevChar {
			cnt++
		} else {
			partLength = append(partLength, cnt)
			prevChar = str[i : i+1]
			cnt = 1
		}
	}
	partLength = append(partLength, cnt)

	var cumSum []int
	cumSum = append(cumSum, 0)
	for i := range partLength {
		cumSum = append(cumSum, cumSum[i]+partLength[i])
	}
	if str[0:1] == "0" {
		cumSum = append([]int{0}, cumSum...)
	}
	if str[n-1:n] == "0" {
		cumSum = append(cumSum, n)
	}

	if len(cumSum) <= 2*k+2 {
		fmt.Println(n)
	} else {
		maxRet := 0
		for i := 0; i < len(cumSum)-(2*k+1); i += 2 {
			maxRet = maxInt(maxRet, cumSum[i+(2*k+1)]-cumSum[i])
		}
		fmt.Println(maxRet)
	}

}


Measured memory_bytes: 7296
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;




int main() {
	int n, m;
	cin >> n >> m;
	int a = 1;
	int b = 1 + m;
	

	for (int i = 0; i < m-m / 2; i++) {
		cout << a << " " << b << endl;
		a++;
		b--;
		
	}
	a = n - m + 1;
	b = n;

	for (int i = 0; i < m / 2; i++) {
		cout << a << " " << b << endl;
		a++;
		b--;
	}

	
}


Measured memory_bytes: 3644
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        
        if(line.contains("7")) {
        	System.out.println("Yes");
        } else {
        	System.out.println("No");
        }
        
    }
}


Measured memory_bytes: 26980
#include<bits/stdc++.h>
        #define ll long long
        #define rep(i,a,b) for(i=a;i<b;i++)
        #define pb push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define CLR(a) memset((a),0,sizeof(a))
        #define mp make_pair
        #define hell 1000000007

        using namespace std;
         //int g[105][105];
        //vector < int > wt(100004);
       // vector < int > a;
        //vector < int > v(30500);
        //int cst[102][100005];
        //int ansr[100005];
     //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;


         /* rep(i,0,50)
          {
              if(ck[i]) cout<<i<< " o"<<endl;
              else cout<<i<<" e"<<endl;
          }*/

        void solve()
        {
          ll int  i,j=0,r=200,p,q,k=0,ans=0,d,y=0,h,flag=0,n,m=0,a,b,id,c,h1,h2,a1,b1;
                cin>>a>>b;

                if(abs(a-b)>=2019 or a%2019==0 or b%2019==0) {cout<<0; return;}
                n=2019;
                a%=n;
                b%=n;

                k=((a*(a+1))%2019);
                            rep(i,a,b+1)
                               {
                                   rep(j,i+1,b+1)
                                      {
                                          k=min(k,(i*j)%n);
                                      }
                               }
                               cout<<k;
        }












        int main()
        {
            ios::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int t=1;
          //  cin>>t;
            while(t--)
            solve();
        }

           /*

      void bfs( int i , int j)
           {
               vis[i][j]= true;
             queue < int > que;
             que.push(k);
             while(!que.empty())
             {
                int x= que.front();
                que.pop();
                 for ( int i=1;i<=n;i++)
                 {
                     if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                     {
                       if(!vis[i])
                       {
                           que.push(i);
                           level[i]=level[x]+1;
                           vis[i]= true;
                       }
                     }
                 }
             }
           }

          ll int por(ll int a,ll int b)
             {
                ll int k=1;
                while(b>0)
                {
                    if(b%2) k=k*a,k%=hell;
                    b/=2;
                    a*=a; a%=hell;
                }
                return k;
             } */


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
  int H,W;
  cin>>H>>W;
  int s[W][H];
  for(int i=0;i<W;i++){
    for(int j=0;j<H;j++){
      char c;
      cin>>c;
      if(c=='#')s[i][j]=0;
      else s[i][j]=1;
    }
  }
  for(int i=1;i<W-1;i++){
    for(int j=1;j<H-1;j++){
      if(s[i][j]==0){
        if(s[i][j-1]==1&&s[i-1][j]==1&&s[i+1][j]==1&&s[i][j+1]==1){
          cout<<"No"<<endl;
          return 0;
        }
      }
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C;
ll ans;
ll x[100000];
ll y[100000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
int main() {
	cin>>N>>M>>X>>Y;
	x[0]=X;
	y[0]=Y;
	rep(i,1,N+1){
		cin>>x[i];
	}
	rep(i,1,M+1){
		cin>>y[i];
	}
	sort(x,x+N+1);
	sort(y,y+1+M);
	if(x[N]<y[0])cout<<"No War"<<endl;
	else cout<<"War"<<endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
res_list = []
for i in range(2**(len(s)-1)):
    res = s[0]
    for j in range(len(s)-1):
        if(i >> j) & 1:
            res += '+'
        res += s[j + 1]
    res_list.append(eval(res))
print(sum(res_list))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main() {
  vector<int> a(250000, 1);
  a[0] = a[1] = 0;
  for(int i = 2;i*i < 250000; ++i)
    if (a[i])
      for(int j = i*i; j < 250000; j+=i)
        a[j] = 0;
  vector<int> b(124000);
  int sum = 0;
  for (int i = 1; i < 124000; ++i) {
    sum += a[2*i] + a[2*i-1];
    sum -= a[i];
    b[i] = sum;
  }
  while(1) {
    int n;
    cin >> n;
    if(!n) break;
    cout << b[n] << endl;
  }
  return 0;
}

Measured memory_bytes: 2584
#include <iostream>

using namespace std;

int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
    	cout << ((i < b) ^ (j < a));
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
    string S;
    cin >> S;

    auto a = stoi(S.substr(0, 2)), b = stoi(S.substr(2));
    int f = 0;

    if (1 <= a and a <= 12)
        f |= 1;

    if (1 <= b and b <= 12)
        f |= 2;

    switch (f) {
    case 1:
        cout << "MMYY\n";
        break;
 
    case 2:
        cout << "YYMM\n";
        break;
 
    case 3:
        cout << "AMBIGUOUS\n";
        break;
 
    default:
        cout << "NA\n";
        break;
    }
 
    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 rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define MAX 200004
#define B 100
#define dpb push_back
#define fi first
#define se second
typedef pair<int, int> P;
typedef long long ll;
const int inf = 1e9;
const ll INF = 1e16;
//__gcd(a,b), __builtin_popcount(a);

ll a[MAX], total;

int solve(ll m, int n){
	int r = 0, l1 = 1, l2 = 1;
	ll sum = 0, s1, s2, s3, t;
	a[0] = 0;
	
	while(r < n){
		/*s1 = *lower_bound(a, a+MAX, sum+m);
		if(s1 == INF){
			r++;sum += a[r];
			continue;
		}
		s2 = *lower_bound(a, a+MAX, s1+m);
		if(s2 == INF){
			r++;sum += a[r];
			continue;
		}
		t = *lower_bound(a, a+MAX, s2+m);
		if(m == 216)printf("%lld %lld %lld %lld\n", s1, s2, t, total+sum-s2);*/
		while(a[l1]-a[r] < m){
			if(a[l1] == INF)break;
			l1++;
		}
		while(a[l2]-a[l1] < m){
			if(a[l2] == INF)break;
			l2++;
		}
		if(a[l1] == INF || a[l2] == INF)return 1;
		
		if(total-(a[l2]-a[r]) >= m){
			return 0;
		}else{
			r++;
			sum += a[r];
		}
	}
	
	return 1;
}

int main(){
	int n;
	scanf("%d", &n);
	fill(a, a+MAX, INF);
	rrep(i,n){
		scanf("%lld", &a[i]);
		a[n+i] = a[i];
	}
	for(int i = 2;i <= 2*n;i++){
		a[i] += a[i-1];
	}
	total = a[n];
	
	ll vl = 0, vr = INF;
	while(vr-vl > 1){
		ll mid = (vr+vl)/2;
		int f = solve(mid, n);
		if(f)vr = mid;
		else vl = mid;
	}
	printf("%lld\n", vl);
	return 0;
}

Measured memory_bytes: 4780
def sumXOR( arr,  n): 
    sum = 0
    for i in range(0, 100): 
        zc = 0
        oc = 0
        idsum = 0
        for j in range(0, n): 
            if (arr[j] % 2 == 0): 
                zc = zc + 1
                  
            else: 
                oc = oc + 1
            arr[j] = arr[j]//2
        idsum = oc * zc * (1 << i)    
        sum = sum + idsum;  
        sum%=10**9+7
    return sum

n=int(input())
arr=list(map(int,input().split()))
sum = sumXOR(arr, n); 
sum%=10**9+7
print(sum)

Measured memory_bytes: 125624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;



int main()
{
    i64 i , j , k , l , m , n , a ;

    i64 odd = 0 , even = 0 ;

    scanf("%lld %lld",&n,&m) ;

    for(i=1 ; i<=n ; i++)
    {
        scanf("%lld",&a) ;
        if(a%2==0) even++ ;
        else odd++ ;
    }
    i64 ret = 1 ;
    for(i=1 ; i<=n-1 ; i++)
    {
        ret = ret*2 ;
    }

    if(odd==0)
    {
        if(m==0) printf("%lld\n",ret*2) ;
        else printf("0\n") ;
    }
    else printf("%lld\n",ret) ;

    return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define pb push_back
#define FILE freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);


using namespace std;

typedef long long ll;

int main(){
    inp_out_work
    int n;
    cin>>n;
    int a[n][3];
    fr(i,n)fr(j,3)cin>>a[i][j];

    ll dp[n][3];

    fr(i,3)dp[0][i] = a[0][i];

    for(int i = 1; i < n; i++){
        dp[i][0] = a[i][0] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = a[i][1] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = a[i][2] + max(dp[i-1][0], dp[i-1][1]);
    }

    cout<< max(dp[n-1][0] , max(dp[n-1][1], dp[n-1][2]));

}


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

int main(int argc, char const *argv[]) {
    int n, x[100], y[100];
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> y[i];
    }

    double distance[4];
    for (int i = 0; i < 4; i++) {
        distance[i] = 0.0;
    }

    for (int p = 1; p <= 3; p++) {
        for (int i = 0; i < n; i++) {
            distance[p] += pow(fabs(x[i] - y[i]), p);
        }
        distance[p] = pow(distance[p], 1.0 / p);
    }

    for (int i = 0; i < n; i++) {
        if (distance[0] < fabs(x[i] - y[i])) {
            distance[0] = fabs(x[i] - y[i]);
        }
    }

    printf("%lf\n", distance[1]);
    printf("%lf\n", distance[2]);
    printf("%lf\n", distance[3]);
    printf("%lf\n", distance[0]);

    return 0;
}



Measured memory_bytes: 3352
#include <iostream>
#include <cstring>
using namespace std;
struct Node {
	int sib;
	int par;
	int chi;
	int dep;
};

Node N[100000] = {-1};

int root;

void print(int id)
{	
	Node cur=N[id];
		cout<< "node " <<id<<": parent = "<<cur.par;
		cout<<", depth = "<<cur.dep;
		if (id==root) cout<<", root, [";
		else if (cur.chi==-1) {cout<<", leaf, []"<<endl;return;}
		else cout<<", internal node, [";
		int chi=cur.chi;
		while(chi!=-1){
			cout << chi;
			chi = N[chi].sib;
			if (chi==-1)break;
			cout<<", ";
		}
		cout<<']'<<endl;
}

int main()
{
	memset(N,-1,sizeof(N));
	int n, id,c,chi,sib;
	cin >>n;
	for(int i=0;i<n;i++){
		cin>>id>>c;
		for(int j=0;j<c;j++)
		{
			cin>>chi;
			if (j==0) N[id].chi=chi;
			else N[sib].sib = chi;
			N[chi].par=id;
			sib=chi;
		}
	}
	
	for (int i=0;i<100000;i++)
	{
		if ((N[i].chi!=-1) && (N[i].par==-1))
		{
			root = i;
		}
	}
	
	id=root;
	int d=0;
	while(1)
	{
		Node &cur = N[id];
		cur.dep =d;
		if (cur.chi!=-1){id = cur.chi;d++;}
		else if (cur.sib!=-1)id=cur.sib;
		else {
			while(1)
			{
				if (d==0) break;
				d--;
				id = N[id].par;
				if (N[id].sib!=-1) 
				{
					id = N[id].sib;
					break;
				}
			}
		}
		if(d==0)break;
	}
	
	for (int i=0;i<100000;i++)
	{
		if (N[i].dep!=-1)
		{
			print(i);
		}
	}
	
	return 0;
}

Measured memory_bytes: 2732
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int s;cin>>s;
    int h=s/3600; s-=(h*3600);
    int m=s/60; s-=(m*60);
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <set>
#include <string>

using namespace std;

set<string> S;
string A, B, C;
int main(void) {
	int N;
	cin >> N >> A >> B >> C;

	int ans = 0;
	for (int i = 0; i < N; i++) {
		S.clear();
		S.insert(A.substr(i, 1));
		S.insert(B.substr(i, 1));
		S.insert(C.substr(i, 1));
		ans += S.size() - 1;
	}

	cout << ans << endl;
	//system("pause");
	return 0;
}

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

using namespace std;

int main(void) {
	int num, i = 0, b;
	long long sum = 0, ans = 0;
	cin >> num;
	vector<int> d(num);
	for (; i < num; i++) {
		scanf("%d", &d[i]);
		d[i] -= i + 1;
	}
	sort(d.begin(), d.end());
	b = d[num >> 1];
	for (i = 0; i < num; i++)
		ans += abs(d[i] - b);
	b = d[(num >> 1) - 1];
	for (sum = 0, i = 0; i < num; i++)
		sum += abs(d[i] - b);
	ans = min(ans, sum);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String c = sc.next();
        String aa = a.substring(a.length() - 1, a.length());
        String bb = b.substring(0, 1);
        String bbb = b.substring(b.length() - 1, b.length());
        String cc = c.substring(0, 1);
        if(aa.equals(bb) && bbb.equals(cc)) System.out.println("YES");
        else System.out.println("NO");
    }
}


Measured memory_bytes: 35616
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    map<string, int> m;
    rep(i,n) {
        string s; cin >> s;
        m[s]++;
    }
    cout << m.size() << endl;
    return 0;
}

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

using namespace std;
int main() {
	string s, t;
	cin >> s >> t;
	if(s == t.substr(0, t.size() - 1)) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}

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

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  vector<int> answers = { a, b, c };
  sort(answers.begin(), answers.end());
  for (int i = 0; i < answers.size(); i++) {
    cout << answers[i];
    if (i != answers.size() - 1) {
      cout << " ";
    }
  }
  cout << endl;

  return 0;
}



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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

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

    int R,G; cin >>R>>G;
    cout << G*2-R << endl;
}


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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}
struct UnionFind {
    int n, cc, *u;
    UnionFind() : n(0), cc(0), u(NULL) {}
    UnionFind(int n_) : n(n_), cc(n_) {
	u = new int[n_];
	memset(u, -1, sizeof (int) * n);
    }
    UnionFind(const UnionFind &y) : n(y.n), cc(y.cc) {
	u = new int[y.n];
	memcpy(u, y.u, sizeof (int) * n);
    }
    ~UnionFind() {
	delete[] u; u = NULL;
	n = cc = 0;
    }
    friend void swap(UnionFind &x, UnionFind &y) {
	swap(x.n, y.n); swap(x.cc, y.cc); swap(x.u, y.u);
    }
    UnionFind& operator=(UnionFind y) { 
	swap(*this, y);
	return *this;
    }
    int root(int x) {
	int y = x, t;
	while (u[y] >= 0) y = u[y];
	while (x != y) { t = u[x]; u[x] = y; x = t; }
	return y;
    }
    bool link(int x, int y) {
	x = root(x); y = root(y);
	if (x == y) return false;
	if (u[y] < u[x]) swap(x, y);
	u[x] += u[y]; u[y] = x; cc--;
	return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -u[root(x)]; }
    int count() { return cc; }
};

int N, Q;
LL M;
UnionFind U;
vector<pair<int, int> > P;

bool solve() {
    if (M == N-1) return P.empty();

    EACH (e, P) {
	int a = e->first, b = e->second;
	if (U.same(a, b)) return false;
    }

    LL c = 0;
    REP (i, N) if (U.root(i) == i) {
	c++;
    }

    if (c <= 2) {
	if (P.empty() && M == N-1) return true;
	else return false;
    }

    if (M - N > c*(c-1)/2 - c) return false;
    else return true;
}

void MAIN() {
    scanf("%d%lld%d", &N, &M, &Q);
    U = UnionFind(N);

    REP (i, Q) {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);

	if (c == 0) {
	    U.link(a, b);
	} else {
	    P.emplace_back(a, b);
	}
    }

    bool yes = solve();
    puts(yes? "Yes": "No");
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 1784
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main()
{
  char topping[3];
  int price = 700;

  scanf("%c%c%c", &topping[0], &topping[1], &topping[2]);
  for(int i = 0; i < 3; i++) {
    if(topping[i] == 'o') {
      price += 100;
    } else if(topping[i] == 'x') {
    } else {
      fprintf(stderr, "Ivalid char: %c\n", topping[i]);
      exit(1);
    }
  }
  printf("%d\n", price);
  return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		sc.close();
		if(b - a == c - b) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	string s;
	cin >> s;
	bool ans = true;
	int ccount = 0;
	int Acount = 0;
	if (s[0] != 'A') {
		ans = false;
	}
	for (int i = 2; i < s.size() - 1; i++) {
		if (s[i] == 'C') {
			ccount++;
		}
	}
	for (int i = 0; i < s.size(); i++) {
		if (s[i] <= 90) {
			Acount++;
		}
	}
	if (ccount != 1 || Acount != 2) {
		ans = false;
	}
	if (ans) {
		cout << "AC" << endl;
	}
	else {
		cout << "WA" << endl;
	}
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);

	public void run() {
		int[][] dp = new int[5][100000];
		dp[0][0] = 1;
		for (int i = 1; i <= 300; i++) {
			int sq = i * i;
			for (int j = 0; j < 4; j++) {
				for (int k = 0; k < dp[j].length; k++) {
					if (k + sq < dp[j].length) {
						dp[j+1][k+sq] += dp[j][k];
					}
				}
			}
		}
		
		while (true) {
			int n = in.nextInt();
			if (n == 0) break;
			
			int res = 0;
			for (int i = 0; i < 5; i++) {
				res += dp[i][n];
			}
			System.out.println(res);
		}
		out.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

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

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

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

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

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

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

Measured memory_bytes: 22176
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N;cin>>N;
    string S;cin>>S;
    int a[100010];
    for(int i=0;i<=1;i++){
        for(int j=0;j<=1;j++){
            a[0]=i,a[1]=j;
            for(int k=2;k<=N;k++){
                if(a[k-1]==0){
                    if(S[k-1]=='o')a[k]=a[k-2];
                    else           a[k]=1-a[k-2];
                }
                else{
                    if(S[k-1]=='o')a[k]=1-a[k-2];
                    else           a[k]=a[k-2];
                }
            }
            int a_N;
            if(a[0]==0){
                if(S[0]=='o')a_N=a[1];
                else         a_N=1-a[1];
            }
            else{
                if(S[0]=='o')a_N=1-a[1];
                else         a_N=a[1];
            }

            if(a[N-1]==a_N && a[0]==a[N]){
                for(int l=0;l<N;l++){
                    if(a[l]==0)cout<<"S";
                    else       cout<<"W";
                }
                return 0;
            }
        }
    }
    cout<<-1<<endl;
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> h(N);

    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }

    int max = *std::max_element(h.begin(), h.end());
    int count = 0;
    while (0 < max)
    {
        // cout << max << "\n";
        bool con = false;
        for (int i = 0; i < N; i++)
        {
            if (h[i] == max)
            {
                con = true;
                h[i]--;
            }
            else if (con)
            {
                break;
            }
        }
        count++;
        max = *std::max_element(h.begin(), h.end());
    }

    cout << count << endl;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

#define NUM 555

ll mp[NUM][NUM];

int main(){
	
	ll n,m,q;cin >> n >> m >> q;
	
	vector<pair<ll,ll>> v;
	REP(i,m){
		ll a,b;cin >> a >> b;
		mp[a][b]++;
	}
	
	REP(j,NUM){
		for(int i = NUM-1;i > 0;i--){
			mp[i-1][j] += mp[i][j];
		}
	}
	
	REP(i,NUM){
		REP(j,NUM-1){
			mp[i][j+1] += mp[i][j];
		}
	}
	
	REP(i,q){
		ll a,b;cin >> a >> b;
		cout << mp[a][b] << endl;
	}
	
	DBG(
	SHOW2d(mp,n+1,n+1);
	)
	
	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

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

    ll n;
    cin>>n;
    string s1,s2,s3,s4;
    s1="AC";
    s2="WA";
    s3="TLE";
    s4="RE";
    ll c1=0,c2=0,c3=0,c4=0;
    for(int i=0;i<n;++i){
        string s;
        cin>>s;
        if(s==s1){++c1;}
        if(s==s2){++c2;}
        if(s==s3){++c3;}
        if(s==s4){++c4;}
    }
    cout<<s1<<" x "<<c1<<endl;
    cout<<s2<<" x "<<c2<<endl;
    cout<<s3<<" x "<<c3<<endl;
    cout<<s4<<" x "<<c4<<endl;

    return (0);
}


Measured memory_bytes: 3676
from collections import deque

def main():
    H,W = map(int, input().split())

    A = [[a for a in input()] for _ in range(H)]
    #stack = deque([(i, j) for i in range(H) for j in range(W) if A[i][j]=="#"])
    stack = [(i, j) for i in range(H) for j in range(W) if A[i][j]=="#"]
    ans = 0
    flag = False
    if stack:
        flag = True
    while flag:
        ans += 1
        flag = False
        #new_stack = deque()
        new_stack = []
        for a,b in stack:
        #while stack:
            #a,b = stack.pop() # 取り出す
            # A[a][b]の隣接マスについて調べる
             # 上
            if a != 0 and A[a-1][b] == ".": # 白の場合
                    A[a-1][b] = "#"
                    new_stack.append((a-1,b))
             # 下
            if a != H-1 and A[a+1][b] == ".": # 白の場合
                    A[a+1][b] = "#"
                    new_stack.append((a+1,b))
            # 左
            if b != 0 and A[a][b-1] == ".": # 白の場合
                    A[a][b-1] = "#"
                    new_stack.append((a,b-1))
            # 右
            if b != W-1 and A[a][b+1] == ".": # 白の場合
                    A[a][b+1] = "#"
                    new_stack.append((a,b+1))
        stack = new_stack
        if stack:
            flag = True
        else:
            ans -= 1 

    print(ans)
            


if __name__ == "__main__":
    main()




Measured memory_bytes: 107176
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
 
bool loop(string s) {
  int cont = 0;
  for (int i = 0; i < s.size()/2; i++) {
    if (s[i] == s[s.size()-i-1]) {
      cont++;
    } else {
      break;
    }
  }
 
  if (cont == s.size()/2) {
    return true;
  } else {
    return false;
  }
}
 
int main() {
  string s;
  cin >> s;

  bool a = loop(s);
  bool first = loop(s.substr(0, s.size()/2));
  bool end = loop(s.substr(s.size()/2+1));

  if (a && first && end) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main()
{
    string T;
    cin >> T;

    string ans;
    for (int i = 0; i < T.size(); i++) {
        ans += T[i] == 'P' ? 'P' : 'D';
    }
    cout << ans << endl;
}

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

int main(){
  while(1){
    int n;
    cin >> n;
    if(n == 0) break;
    int sum=0;
    double me, D=0;
    vector<int> s(n);
    for(int &x: s){
      cin >> x;
      sum+=x;
    }
    me=(double)sum/s.size();
    for(int x: s){
      D+=pow(x-me,2);
    }
    D/=s.size();
    D=sqrt(D);
    cout << D << endl;
  }
  return 0;
}


Measured memory_bytes: 3188
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	set<int> se;
	int ans = 0;
	rep(i,n){
		int t;
		cin>>t;
		if(t>=3200) ans++;
		else{
			se.insert(t/400);
		}
	}
	ans += se.size();
	cout<<max((int)se.size(),1)<<" "<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

// π M_PI
// deg = rad*180/M_PI

int main() {
    string s;
    cin >> s;
    std::vector<char> v;
    rep(i, s.size()) {
        v.push_back(s[i]);
    }
    ll q;
    cin >> q;
    ll num[q];
    ll f[q];
    char c[q];

    rep(i, q) {
        cin >> num[i];
        if ( num[i] == 2 ) {
            cin >> f[i] >> c[i];
        }
    }
/*
    int keep = 0;
    rep(i, q) {
        if ( num[i] == 1 ) {
            if ( num[i+1] != 1 || num[i-1] != 1 ) {
                reverse(ALL(v));
            }
        } else {
            if ( f[i] == 1 ) {
                v.insert(v.begin(), c[i]);
            } else {
                v.insert(v.end(), c[i]);
            }
        }
    }
*/
    ll top = 0;
    rep(i, q) {
        if ( num[i] == 1 ) {
            top = !top;
        } else {
            if (top) {
                if ( f[i] == 1 ) {
                    v.push_back(c[i]);
                } else {
                    v.insert(v.begin(), c[i]);
                }
            } else {
                if ( f[i] == 1 ) {
                    v.insert(v.begin(), c[i]);
                } else {
                    v.push_back(c[i]);
                }
            }
        }
    }

    if (top) {
        reverse(ALL(v));
    }

    rep(i, v.size()) {
        cout << v[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 4472
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  string s; cin>>s;
  int cnt=0;
  for(int i=0;i<n;++i){
    if(s[i]=='(') cnt++;
    if(s[i]==')'){
      if(cnt>0) cnt--;
      else cout<<'(';
    }
  }
  cout<<s;
  if(cnt)
    for(int i=0;i<cnt;++i) cout<<')';
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

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

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	ll ans = 0;
	vector<ll>res(1010101);
	for (ll i = 2;i <= 1010101;++i) {
		while (n % i == 0) {
			n /= i;
			res[i]++;
		}
	}
	for (ll i = 2;i <= 1010101;++i) {
		ll res2 = 1;
		while (res[i]>0&&res[i]>=res2) {
			res[i] -= res2;
			ans++;
			res2++;
		}
	}
	if (n != 1)ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11184
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 998244353
//ａをbで割る
long long mod_div(ll a,ll b){
	if(a % b == 0)return a/b;
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}
 
#define MAX_K 333333
vector<long long> kaijo(MAX_K);
long long combination(long long n, long long r){
    if(n < r || n < 0 || r < 0)
        return 0;
	if(kaijo[0] != 1){
		kaijo[0] = 1;
		for(long long i = 1;i < MAX_K;i++)kaijo[i] = (kaijo[i-1] * i) % MOD;
	}
    long long ret = kaijo[n];
	long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
    return mod_div(ret,tmp);
}

int main() {
	ll N, A, B, K;
	cin >> N >> A >> B >> K;

	ll ans = 0;
	for(int x = 0; x <= N; x++) {
		/* Ax+By=K */
		ll ytmp = K - A*x;
		ll y = mod_div(ytmp, B);
		if(ytmp % B == 0 && y <= N) {
			ans += (combination(N, x) * combination(N, y)) % MOD;
			ans %= MOD;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
map<int,int> p={{0,1}};
long long s,n,m,a,b;
int main() {
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a;
		b+=a;
		s+=p[b%=m]++;
	}
	cout<<s;
	return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <stdlib.h>
#define N 100

int G[N][N] = {0};

int main ()
{
    int n , i, j, k, u, v;
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        scanf("%d %d", &u, &k);
        for (j = 0; j < k; j++) {
            scanf("%d", &v);
            G[u-1][v-1] = 1;
        }
    }
    
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            if (j != 0) {
                printf(" ");
            }
            printf("%d", G[i][j]);
        }
        puts("");
    }
    
    return 0;
}

Measured memory_bytes: 648
//08-4 星座探し
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<set>
#include<stack>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<cassert>
using namespace std;
#define LL long long
#define ROOP() while(true)
int main(){
    ROOP(){
        //データ入力
        int m;
        cin >> m;
        if(m == 0) break;

        int xmin = 1000000;
        int xmax = 0;
        int ymin = 1000000;
        int ymax = 0;
        vector<pair<int,int>> seiza;
        for(int i=0; i<m; i++){
            int x,y;
            cin >> x >> y;
            seiza.push_back(make_pair(x,y));
            xmin = min(xmin,x);
            xmax = max(xmax,x);
            ymin = min(ymin,y);
            ymax = max(ymax,y);
        }

        int xsize = xmax-xmin;
        int ysize = ymax-ymin;

        int n;
        cin >> n;

        int pxmin = 1000000;
        int pxmax = 0;
        int pymin = 1000000;
        int pymax = 0;
        vector<pair<int,int>> pic;
        set<pair<int,int>> pics;
        for(int i=0; i<n; i++){
            int x,y;
            cin >> x >> y;
            pic.push_back(make_pair(x,y));
            pics.insert(make_pair(x,y));
            pxmin = min(pxmin,x);
            pxmax = max(pxmax,x);
            pymin = min(pymin,y);
            pymax = max(pymax,y);
        }

        //サーチ処理
        //pic.at(i)がseiza.at(0)か
        int hidari = seiza.at(0).first - xmin;
        int migi = xmax - seiza.at(0).first;
        int ue = seiza.at(0).second - ymin;
        int sita = ymax - seiza.at(0).second;
        for(int i=0; i<n; i++){
            if(pic.at(i).first-hidari>=pxmin && pic.at(i).first+migi<=pxmax && pic.at(i).second-ue>=pymin && pic.at(i).second+sita<=pymax){
                bool flg = true;
                for(int j=0; j<m; j++){
                    int sax = seiza.at(j).first - seiza.at(0).first;
                    int say = seiza.at(j).second - seiza.at(0).second;
                    if(pics.count(make_pair(pic.at(i).first+sax, pic.at(i).second+say)) >= 1){

                    }
                    else{
                        flg = false;
                        j=m;
                    }
                }
                if(flg){
                    cout << pic.at(i).first-seiza.at(0).first << " " << pic.at(i).second-seiza.at(0).second << endl;
                    i=n;
                }
            }
        }

    }
    return 0;
}


Measured memory_bytes: 3040