akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  if( (A == 1 && B == 2) || (A == 2 && B == 1))
    cout << 3 << endl;
  else if ( (A == 2 && B == 3) || (B == 2 && A == 3))
    cout << 1 << endl;
  else
    cout << 2 << endl;
}

Measured memory_bytes: 256
// C++ program to find the minimum sum of costs such that
// each elements choose one of the costs.
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n,k;
	cin>>n;
	int a[n],b[n],c[n];
	int i,j;
	for(i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];
	int dp[n][3];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	for(i=1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
const ll mod = 1000000007;
const ll mod9 = 1000000009;

signed main(){
    string s,t;
    cin>>s>>t;
    ll sz = s.size();
    ll ans = 0;
    rep(i,sz){
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
bool mar[21][21];
int a,b,ans;
queue<int>q;
queue<int>q1;
queue<int>q2;
struct{
	string li;
}line[21];
int main()
{
	cin>>a>>b;
	for(int i=0;i<a;i++)
	{
		cin>>line[i].li;
	}
	for(int i=0;i<a;i++)
	{
		for(int j=0;j<b;j++)
		{
			if(line[i].li[j]!='#')
			{
				q.push(i);
				q1.push(j);
				q2.push(0);
				while(!q.empty())
				{
					if(line[q.front()].li[q1.front()]!='#'&&mar[q.front()][q1.front()]==0)
					{
						if(q.front()<a-1)
						{
							q.push(q.front()+1);
							q1.push(q1.front());
							q2.push(q2.front()+1);
						}
						if(q.front()>0)
						{
							q.push(q.front()-1);
							q1.push(q1.front());
							q2.push(q2.front()+1);
						}
						if(q1.front()<b-1)
						{
							q.push(q.front());
							q1.push(q1.front()+1);
							q2.push(q2.front()+1);
						}
						if(q1.front()>0)
						{
							q.push(q.front());
							q1.push(q1.front()-1);
							q2.push(q2.front()+1);
						}
						ans=max(ans,q2.front());
					}
						mar[q.front()][q1.front()]=1;
					q1.pop();
					q.pop();
					q2.pop();
				}
			}
			for(int k=0;k<20;k++)
				for(int l=0;l<20;l++)
					mar[k][l]=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl


int main(){
    int n,m;
    cin>>n>>m;
    int one=n+18*m;
    cout<<(one<<m)<<"00"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 100005
#define M 200005
#define seed 23333

using namespace std;
int i,j,m,n,p,k,a[N];
long long Ans[N];
map<int,int>mp,id;
int main()
{
	scanf("%d",&n); int nowmin=n+1,sum=0;
	for (i=1;i<=n;++i)
	{
			 scanf("%d",&a[i]);
			 mp[a[i]]++;
			 if (id.find(a[i])==id.end()) id[a[i]]=i;
	}
	mp[0]++;
	for (map<int,int>::iterator it=--mp.end();;--it)
	{
			if (it==mp.begin()) break;
			nowmin=min(nowmin,id[it->fi]);
			sum+=it->se;
			--it;
			int last=it->fi;
			++it;
			Ans[nowmin]+=1ll*(it->fi-last)*sum;
	}
	for (i=1;i<=n;++i) printf("%lld\n",Ans[i]);
}


Measured memory_bytes: 11648
#include<cstdio>

int a[100005];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int flag=0;
	int num=1;
	int t=1;
	for(int i=1;i<n;i++){
		if(flag==0){
			for(int j=i+1;j<=n;j++){
				if(a[j]!=a[i]){
					if(a[j]>a[i]) flag=1;
					else flag=-1;
					i=j-1;
					break;
				}
			}
		}
		else{
			if(flag==1&&a[i+1]<a[i]){
				flag=0;
				t=0;
				num++;
			}
			else if(flag==-1&&a[i+1]>a[i]){
				flag=0;
				t=0;
				num++;
			}
		}	
	}
	if(flag==0&&t==1) printf("1\n");
	else{
		printf("%d\n",num);
	}
	return 0;
}


Measured memory_bytes: 512
def isPrime(x):
    if x==1:
        return False
    for i in range(2, int(x**0.5)+1):
        if x%i==0:
            return False
    return True

def primeFactorization2(x):
    ps = []
    es = []
    i=2
    k=x
    while i<=k**0.5:
        if k%i==0 and isPrime(i):
            ps.append(i)
            e=0
            while k%i==0:
                k = k//i
                e+=1
            es.append(e)
        i+=1
    if x==1:
        return [[],[]]
    elif isPrime(x):
        return [[x],[1]]
    else:
        return [ps + primeFactorization2(k)[0], es + primeFactorization2(k)[1]]


n=int(input())

if isPrime(n):
    print(1)
else:
    nums = primeFactorization2(n)[1]

    ans=0
    for i in nums:
        ans += int(((1+8*i)**0.5-1)/2)

    print(ans)
    
            
        
    
    
    


Measured memory_bytes: 64452
class Node:
    def __init__(self, left, right, date):
        self.left = left
        self.right = right
        self.date = date

root = Node(None, None, None)
cur = root.right = Node(root, None, None)

def insert(x, cur):
    cur.left.right = cur.left = cur = Node(cur.left,cur, x)
    return cur

def move(x, cur):
    d = int(x[0])
    if d > 0:
        for _ in range(d):
            cur = cur.right
    else:
        for _ in range(-d):
            cur = cur.left
    return cur

def erase(_,cur):
    cur.right.left = cur.left
    cur.left.right = cur.right
    cur = cur.right
    return cur

C = {'0':insert, '1':move, '2':erase}
n = int(input())
for _ in range(n):
    query = input().split()
    cur = C[query[0]](query[1:], cur)

ans = []
it = root.right
while it.right:
    ans.append(it.date)
    it = it.right

for i in range(len(ans)):
    print(ans[i][0])

    


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

using lint = long long;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
template <typename T> using VVV = vector<vector<vector<T>>>;
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repu(i, a, b, s) for(int i = int(a); i < int(b); i += int(s))
#define repd(i, a, b, s) for(int i = int(a); i > int(b); i += int(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

void solve() {
    int A, B;
    cin >> A >> B;

    if(A % 2 == 1 and B % 2 == 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}

Measured memory_bytes: 3576
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, W;
    cin >> N >> W;
    int w[110], v[110];
    rep(i, N) cin >> w[i] >> v[i];
    vector<int> vec[4];
    rep(i, N) {
        vec[w[i] - w[0]].push_back(v[i]);
    }
    rep(i, 4) sort(vec[i].begin(), vec[i].end(), greater<int>());
    int ans = 0;
    rep(i, vec[0].size() + 1) {
        rep(j, vec[1].size() + 1) {
            rep(k, vec[2].size() + 1) {
                rep(l, vec[3].size() + 1) {
                    int weight = 0;
                    weight += i * w[0];
                    weight += j * (w[0] + 1);
                    weight += k * (w[0] + 2);
                    weight += l * (w[0] + 3);
                    if(weight > W) continue;
                    int value = 0;
                    rep(s, i) value += vec[0][s];
                    rep(s, j) value += vec[1][s];
                    rep(s, k) value += vec[2][s];
                    rep(s, l) value += vec[3][s];
                    ans = max(ans, value);
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
cnt_s=n
cnt_c=m
ans=0
if cnt_s>cnt_c:
  ans=cnt_c//2
  print(ans)
elif cnt_s<=cnt_c:
  ans+=min(n,cnt_c//2)
  cnt_c-=2*min(n,cnt_c//2)
  ans+=cnt_c//4
  print(ans)



Measured memory_bytes: 2940
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	string S, T; cin >> S >> T;
	bool ans = false;
	{
		bool ok = true;
		int now = 0;
		for (int i = 0; i < S.size(); i += 2) {
			int next = T.find(S[i], now);
			if (next == string::npos) {
				ok = false;
				break;
			}
			now = next+1;

		}
		if (ok)ans = true;
	}
	{
		bool ok = true;
		int now = 0;
		for (int i = 1; i < S.size(); i += 2) {
			int next = T.find(S[i], now);
			if (next == string::npos) {
				ok = false;
				break;
			}
			now = next+1;

		}
		if (ok)ans = true;
	}
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 3220
#include<stdio.h>

int main(void){
int a,b,c,tmp;
scanf("%d %d %d",&a,&b,&c);
if(a>b){
  tmp=a;
  a=b;
  b=tmp;
}
if(b>c){
  tmp=b;
  b=c;
  c=tmp;
}
if(a>b){
  tmp=a;
  a=b;
  b=tmp;
}
printf("%d %d %d\n",a,b,c);
  return 0;
}



Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
const int nax = 5e5 + 10;
int lc[nax * 40], rc[nax * 40], root[nax];
int sg[nax * 40];
int cnt;

inline void update (int &v, int x, int y, int pos, int val) {
    ++ cnt;
    sg[cnt] = sg[v];
    lc[cnt] = lc[v];
    rc[cnt] = rc[v];
    v = cnt;
    if (x == y) {
        sg[v] = val;
    } else {
        int mid = x + y >> 1;
        if (pos <= mid) update(lc[v], x, mid, pos, val);
        else update(rc[v], mid + 1, y, pos, val);
        sg[v] = sg[lc[v]] + sg[rc[v]];
    }
}

inline int query (int v, int x, int y, int l, int r) {
    if (l == x && r == y) {
        return sg[v];
    } else {
        int mid = x + y >> 1;
        if (l > mid) return query(rc[v], mid + 1, y, l, r);
        else if (r <= mid) return query(lc[v], x, mid, l, r);
        else return query(lc[v], x, mid, l, mid) + query(rc[v], mid + 1, y, mid + 1, r);
    }
}

int n, q;
int c[nax];
int lst[nax];
/**
    last appearance
    moving by r
*/

int main () {
    cin.tie(0)->sync_with_stdio(false);
    cin >> n >> q;

    for (int i = 1 ; i <= n ; ++ i) {
        cin >> c[i];
    }

    for (int i = 1 ; i <= n ; ++ i) {
        int cur = root[i - 1];
        if (lst[c[i]]) {
            update(cur, 1, n, lst[c[i]], 0);
        }
        update(cur, 1, n, i, 1);
        root[i] = cur;
        lst[c[i]] = i;
    }

    for (int i = 1 ; i <= q ; ++ i) {
        int l, r;
        cin >> l >> r;
        cout << query(root[r], 1, n, l, r) << '\n';
    }

}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i <= k; i++)
#define SZ 100010
#define PB push_back
#define MEM(n, val) memset((n), val, sizeof(n))
#define INF 1000000000
#define F first
#define S second
#define MP make_pair
#define LL long long


int n;
int ara[110];

int get_min(int le, int ri)   {
    int mn = 10000;
    FOR(i, le, ri)   {
        mn = min(mn, ara[i]);
    }
    return mn;
}

void sub(int le, int ri, int mn)    {
    mn = get_min(le, ri);
    FOR(i, le, ri)   {
        ara[i] -= mn;
    }
}

int ans = 0;

int func(int le, int ri)    {
    int mn = get_min(le, ri);
    sub(le, ri, mn);

    ans += mn;

    FOR(i, le, ri)   {
        if(ara[i] == 0)    {
            continue;
        }
        int past = i;
        while((i <= ri) && (ara[i] > 0)) {
            i++;
        }
        i--;
        func(past, i);
    }
}

int main()  {
//    freopen("in.txt", "r", stdin);
    cin >> n;
    FOR(i, 0, n - 1)   {
        cin >> ara[i];
    }
    func(0, n - 1);

    cout << ans;
    return 0;
}
/**
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int sum = 0;
    map<int, int> m;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        m[x]++;
        sum += x;
    }


    int q;
    cin >> q;
    while(q--) {
        int b, c;
        cin >> b >> c;
        m[c] += m[b];
        sum -= (m[b]*b);
        sum += (m[b]*c);
        m[b] = 0;
        /*for(auto i : m) {
            cout << i.first << " " << i.second << "\n";
        }
        cout << "\n";*/
        cout << sum << "\n";
    }
    return 0;
}


Measured memory_bytes: 9444
#include<iostream>
using namespace std;
int main()
{
    long unsigned int a;
    string b;
    cin >> a;
    cin >> b;
    if (b.length() > a)
    {
        cout << b.substr(0,a) << "...";
        return 0;
    } else
    {
        cout << b;
        return 0;
    }
}


Measured memory_bytes: 3604
#include<stdio.h>
int main(void){
	int n,t[4][13],i,j,k;
	char e;
	for(i=0;i<=3;i++){
		for(j=0;j<=12;j++){
			t[i][j]=0;
		}
	}
	scanf("%d",&n);
	for(k=1;k<=n;k++){
		scanf("%s %d",&e,&j);
		switch (e){
			case 'S':
				i=0;
				break;
			case 'H':
				i=1;
				break;
			case 'C':
				i=2;
				break;
			case 'D':
				i=3;
				break;
		}
		t[i][j-1]=1;
	}
	for(i=0;i<=3;i++){
		for(j=0;j<=12;j++){
			if(t[i][j]==0){
				switch (i){
					case 0:
						printf("S %d\n",j+1);
						break;
					case 1:
						printf("H %d\n",j+1);
						break;
					case 2:
						printf("C %d\n",j+1);
						break;
					case 3:
						printf("D %d\n",j+1);
						break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define int long long
#define md 1000000007
using namespace std;
int power(int x,int y, int p) 
{ 
   int res = 1;     
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
main()
{
	//freopen("input.txt","rt",stdin);
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int ans =0;
	for(int i=0;i<60;i++)
	{
		int z = 0;
		int o = 0;
		for(int j=0;j<n;j++)
		{
			if(arr[j]%2 == 0)
			{
				z++;
			}
			else
			{
				o++;
			}
			arr[j]/=2;
		}
		int t = 2;
		int p = (z * o) % md;
		ans = ans + (p *power(t,i,md) % md);
		ans %= md;
	}
	ans %= md;
	cout<<ans<<endl;
}

Measured memory_bytes: 2560
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long

# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;


int main()
{
    speed;
    #ifdef DEBUGfd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG

    //Code begins
    string str;
    cin>>str;
    int n = str.size();

    str = str.substr(0, n-1);
    int even = 0;
    string a, b;


    while(even == 0)
    {
          n = str.size();
          if( n % 2 == 0)
          {
            a = str.substr(0, n/2);
            b = str.substr(n/2, n/2);
            if(a == b)
            {even = 1;
              break;}
          }
          str = str.substr(0, n-1);
    }

    if(even)
    cout<<str.size()<<endl;






    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
  int A,B,C,X,count=0;
  cin >> A >> B >> C >> X;
  for(int a=0;a<=A;++a){
    for(int b=0;b<=B;++b){
      for(int c=0;c<=C;++c){
        if(X == 500*a + 100*b + 50*c) ++count; 
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    val ans = IntArray(M)
    repeat(N) {
        readLine()!!.split(" ").map(String::toInt).drop(1).forEach {
            ans[it - 1]++
        }
    }

    ans.filter { it == N }.size.let(::println)

}

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

#define INFTY (1 << 30);
typedef long long ll;

int main(void) {
  int a[5];
  int sum = 0;

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

  // choose minimum
  int last_tag = 9;
  int last = 199;
  int all_ten = true;
  for (int i = 0; i < 5; i++) {
    if (a[i]%10 == 0) continue;
    if (a[i]%10 <= last_tag) {
      last = a[i];
      last_tag = a[i] % 10;
      all_ten = false;
    }
  }

  if (all_ten == true) {
    for (int i = 0; i < 5; i++) {
      sum += a[i];
    }
    cout << sum << endl;
    return 0;
  }

  int pass = false;
  for (int i = 0; i < 5; i++) {
    if (a[i] == last
        && pass == false) {
      pass = true;
      continue;
    }
    else
      sum += a[i];
    if (a[i] % 10 != 0){
      sum += (10 - a[i] % 10);
    }
  }
  sum += last;
  cout << sum << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
using namespace std;
 
int main(){
	int n,k;cin>>n>>k;
	int a=1;
	for(int i=0;i<n;i++){
		if(a*2<a+k)a*=2;
		else a+=k;
	}
	cout<<a<<endl;
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FORr(i, j, 0)
#define INF (1<<30)
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

int N, M;
vector<int> G[10];
bool went[10];
int cnt = 0;

void dfs(int V) {
        FOR(i, 1, N + 1) {
                if(!went[i]) break;
                if(i == N) {
                        ++cnt;
                        return;
                }
        }
        rep(i, G[V].size()) {
                if(!went[G[V][i]]) {
                        went[G[V][i]] = true;
                        dfs(G[V][i]);
                        went[G[V][i]] = false;
                }
        }
        return;
}

int main() {
        scanf("%d %d", &N, &M);
        memset(went, false, sizeof(went));
        rep(i, M) {
                int a, b;
                scanf("%d %d", &a, &b);
                G[a].push_back(b);
                G[b].push_back(a);
        }
        went[1] = true;
        dfs(1);
        printf("%d\n", cnt);
        return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[200010];
set<int> U;

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	REP(i,N){
		if(U.find(A[i])!=U.end()){
			cout<<"NO"<<endl;
			return 0;
		}
		U.insert(A[i]);
	}
	cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 11136
process.stdin.resume();
process.stdin.setEncoding('utf8');
// 自分の得意な言語で
// Let's チャレンジ！！

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  var x= parseInt(lines[0],10);
  var y = Math.floor(x/100);
if(y<1){
    console.log(0);
}else{
    var aa= x%100;
 
    if(aa<=y*5){
        console.log(1);
    }else{
        console.log(0);
    }
}
  
  
  
  
  
});

Measured memory_bytes: 21448
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false); 
    
    int N; cin >> N;
    vl x(N), y(N); 
    REP(i, N) cin >> x[i] >> y[i];

    if (N==1){
        cout << 1 << endl;
        return 0;
    }

    map<pii, int> mp;
    REP(i,N) {
        REP(j,N) {
            if (j == i) continue;
            mp[pii(x[j] - x[i], y[j] - y[i])]++;
        }
    }

    int ans = INF;
    for(auto p : mp) {
        ans = min(ans, N - p.second);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

int main() {
	fastio; int x; cin >> x;
  cout << (x >= 30 ? "Yes" : "No");
}


Measured memory_bytes: 3652
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

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

#define forn(i, a, n) for (int i = (a); i < (int)n; i++)
#define trav(x, arr) for (auto &x : arr)
#define sz(x) (int)x.size()
#define Matrix(m, h, w) std::vector<vector<int>> m(h, vector<int> (w)); 
using ll = long long;

#define vi vector<int>
#define vl vector<long>
#define vll vector<ll>

// benq
const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;


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

    int n; cin >> n;

    vi arr(n);
    forn(i,0,n) cin >> arr[i];


    int x = arr[0];

    forn(i, 1, n) {
        x ^= arr[i];
    }

    for (int i = 0; i < n; i++) {
        int z = x^arr[i];
        cout << z << " ";
    }



    return 0;
}

Measured memory_bytes: 3948
N = int(input())
t = []
for _ in range(N):
    A = int(input())
    tt = []
    for _ in range(A):
        tt.append(list(map(int, input().split())))
    t.append(tt)
ans = 0
for b in range(1 << N):
    f = True
    for i, tt in enumerate(t):
        for x, y in tt:
            if b & 1 << i:
                if (b & 1 << (x - 1)) >> (x - 1) != y:
                    f = False
                    break
    if f:
        ans = max(ans, bin(b).count('1'))

print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

/**
 * Segment Tree. This data structure is useful for fast folding on intervals of an array
 * whose elements are elements of monoid M. Note that constructing this tree requires the identity
 * element of M and the operation of M.
 * Header requirement: vector, algorithm
 * Verified by AtCoder ABC017-D (http://abc017.contest.atcoder.jp/submissions/660402)
 */
template<class I, class BiOp = I (*) (I, I)>
class SegTree {
  int n;
  std::vector<I> dat;
  BiOp op;
  I e;
public:
  SegTree(int n_, BiOp op, I e) : op(op), e(e) {
    n = 1;
    while (n < n_) { n *= 2; } // n is a power of 2
    dat.resize(2 * n);
    for (int i = 0; i < 2 * n - 1; i++) {
      dat[i] = e;
    }
  }
  /* ary[k] <- v */
  void update(int k, I v) {
    k += n - 1;
    dat[k] = v;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = op(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }
  void update_array(int k, int len, const I *vals) {
    for (int i = 0; i < len; ++i) {
      update(k + i, vals[i]);
    }
  }
  /*
    Updates all elements. O(n)
   */
  void update_all(const I *vals, int len) {
    for (int k = 0; k < std::min(n, len); ++k) {
      dat[k + n - 1] = vals[k];
    }
    for (int k = std::min(n, len); k < n; ++k) {
      dat[k + n - 1] = e;
    }
    for (int b = n / 2; b >= 1; b /= 2) {
      for (int k = 0; k < b; ++k) {
	dat[k + b - 1] = op(dat[k * 2 + b * 2 - 1], dat[k * 2 + b * 2]);
      }
    }
  }
  /* l,r are for simplicity */
  I querySub(int a, int b, int k, int l, int r) const {
    // [a,b) and  [l,r) intersects?
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return dat[k];
    I vl = querySub(a, b, 2 * k + 1, l, (l + r) / 2);
    I vr = querySub(a, b, 2 * k + 2, (l + r) / 2, r);
    return op(vl, vr);
  }
  /* [a, b] (note: inclusive) */
  I query(int a, int b) const {
    return querySub(a, b + 1, 0, 0, n);
  }
};



int main(void){
  int n;
  ll k;
  cin >> n >> k;
  VL a(n);
  REP(i, 0, n) {
    cin >> a[i];
    a[i] -= k;
  }
  VL acc(n + 1, 0);
  REP(i, 0, n) {
    acc[i + 1] = acc[i] + a[i];
  }
  set<ll> comp;
  REP(i, 0, n + 1) {
    comp.insert(acc[i]);
  }
  VL tbl(comp.begin(), comp.end());
  map<ll, int> tbl_inv;
  int m = comp.size();
  REP(i, 0, m) {
    tbl_inv[tbl[i]] = i;
  }
  REP(i, 0, n + 1) {
    acc[i] = tbl_inv[acc[i]] + 1;
  }
  SegTree<ll, plus<ll> > st(n + 4, plus<ll>(), 0);
  ll tot = 0;
  REP(i, 0, n + 1) {
    int t = acc[i];
    tot += st.query(0, t);
    st.update(t, st.query(t, t) + 1);
  }
  cout << tot << endl;
}


Measured memory_bytes: 30976
#include<bits/stdc++.h>
using namespace std;
int dp[1000][1000];
 int main()
 {
     int r,c;
     cin>>r>>c;
     string s[r];
     for(int i=0;i<r;i++)
     {cin>>s[i];}
     
     dp[0][0]=1;
for(int i=0;i<r;i++)
{if(s[i][0]=='.')
dp[i][0]=1;
else
break;
}
for(int i=0;i<c;i++)
{if(s[0][i]=='.')
dp[0][i]=1;
else
 break;
}

for(int i=1;i<r;i++)
{
    for(int j=1;j<c;j++)
    {if(s[i][j]=='.')
    	{if(s[i-1][j]=='.')
    	dp[i][j]+=dp[i-1][j];
    	if(s[i][j-1]=='.')
    	dp[i][j]+=dp[i][j-1];
    	}
    	dp[i][j]%=(long long)(1e9+7);
       
    }
}

cout<<dp[r-1][c-1];
     
 }

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

int main(){
  ll n;
  cin >> n;
  ll ans = 0;
  for(ll i = 1; i*i <= n; i++) {
    if(n % i == 0) {
      if(n/i >= i+2) ans +=  n/i - 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    String[] input = in.nextLine().split(" ");
    
    System.out.println(gcd(Integer.parseInt(input[0]), Integer.parseInt(input[1])));
  }
  
  public static int gcd(int x, int y) {
    if(y != 0) {
      return gcd(y, x%y);
    } else {
      return x;
    }
  }
}


Measured memory_bytes: 26280
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9 + 7;
const double PI = 3.14159265358979323846;
template <class T, class U>
void chmin(T& t, const U& u) {
  if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
  if (t < u) t = u;
}

int main(void) {
  int n;
  cin >> n;
  int cnt = 0;
  bool find = false;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      cnt++;
    } else {
      cnt = 0;
    }
    if (cnt >= 3) find = true;
  }
  cout << (find ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>
#include <cstdio>
#include <bitset>
#include <map>
#include <string>
// #include <cctype>


using namespace std;

int main()
{
    double a, b, C;

    cin >> a >> b >> C;

    C = C/180 * atan(1)*4;
    cout << fixed;
    cout << a * b * sin(C) / 2 <<endl;
    cout << a + b + sqrt(pow(a, 2) + pow(b, 2) - 2*a*b*cos(C)) << endl;
    cout << b * sin(C) << endl;
}


Measured memory_bytes: 3536
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

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

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string n;cin>>n;
    for(int i=0;i<n.length();i++){
        if(n[i]=='1')
            n[i]='9';
        else if(n[i]=='9')
            n[i]='1';
    }
    cout<<n<<endl;
    
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256
n,x = map(int,input().split())
s = list(map(int,input().split()))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

for i in range(n):
    s[i] = abs(s[i] - x)

if s[0] != 0:
    t = s[0]
    for i in range(n-1):
        if s[i+1] == 0:
            continue
        else:
            t = gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = gcd(t,s[-i-1])

print(t)

Measured memory_bytes: 14252
#include <iostream>

void solve() {
    std::string s;
    std::cin >> s;
    std::cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No")
              << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
int a[200000],x[200000];
map<int,int> m;
signed main(){
	int n,ans=0;
	cin>>n;
	f(i,n){
		cin>>a[i];
		if(i) x[i]=x[i-1]+a[i];
		else x[i]=a[i];
		m[x[i]]++;
	}
	for(P p:m){
		int z=1;
		for(int i=p.S-1;i<=p.S;i++) z*=i;
		ans+=z/2;
		if(!p.F) ans+=p.S;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

int main (void) {
    long long N;
    cin >> N;
    long long A_sum = 0;
    vector<long long> A(N);
    for ( long long i = 0; i < N; i++ ) {
        cin >> A.at(i);
        A_sum += A.at(i);
    }
    long long Q;
    cin >> Q;
    vector<long long> B(Q);
    vector<long long> C(Q);
    for ( long long i = 0; i < Q; i++ ) {
        cin >> B.at(i) >> C.at(i);
    }

    map<long long, long long> n;
    for ( long long i = 0; i < N; i++ ) {
        n[A.at(i)]++;
    }

    for ( long long i = 0; i < Q; i++ ) {
        if ( n.find(B.at(i)) == n.end() ) {
            cout << A_sum << endl;
            continue;
        }
        A_sum = A_sum - n.at(B.at(i)) * B.at(i) + n.at(B.at(i)) * C.at(i);
        n[C.at(i)] += n.at(B.at(i));
        n[B.at(i)] = 0;
        cout << A_sum << endl;
    }

    return 0;
}


Measured memory_bytes: 10580
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main() {

	int N;

	cin >> N;

	vector<int>A(N);
	vector<int>B(N);
	vector<int>C(N);

	for (int i=0; i < N; i++)
		cin >> A.at(i);

	for (int i=0; i < N; i++)
		cin >> B.at(i);

	for (int i=0; i < N-1; i++)
		cin >> C.at(i);

	int cnt=0;

	for (int i = 0; i < N; i++) {
		
		cnt += B[A[i]-1];

//		cout << cnt << endl;


		if (i < N && A[i] + 1 == A[i + 1])
			cnt += C[A[i]-1];

//		cout << cnt << endl;
				
	}


	cout << cnt << endl;


	return 0;
}

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

void solve() {
    string S, T;
    cin >> S >> T;
    int a, b;
    cin >> a >> b;
    string U;
    cin >> U;
    if (U == S) {
        printf("%d %d\n", --a, b);
    } else {
        printf("%d %d\n", a, --b);
    }
}


int main() {
    solve();
    return 0;
}


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


long long odd_xor(ll a){
    if ((a+1)/2 % 2 == 1){
        return 0;
    }else{
        return 1;
    }
}

long long even_xor(ll a){
    return odd_xor(a+1)^(a+1);
}

ll calc_xor(ll a){
    if (a % 2 == 1){
        return odd_xor(a);
    }
    else{
        return even_xor(a);
    }
}


int main(){

    ll A, B;
    cin >> A >> B;
    cout << (calc_xor(B) ^ calc_xor(A-1)) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  long long N,K;
  scanf("%lld%lld",&N,&K);

  long long cnt = -1;
  int sum = 0;
  while(sum <= N){
    sum += K;
    cnt++;
  }
  long long cnt1 = 0;
  if(K%2 == 0){
    sum = K/2;
    while(sum <= N){
      sum += K;
      cnt1++;
    }
  }

  printf("%lld\n",cnt*cnt*cnt+cnt1*cnt1*cnt1);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
#include <map>
#include <unordered_map>
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    ll n, sumed=0; std::cin >> n;
    std::vector<ll> v(100001,0);
    for(ll i=0; i<n; i++){
        ll ai; std::cin >> ai;
        v[ai]++; sumed+=ai;
    }

    ll q; std::cin >> q;
    std::vector<ll> b(q),c(q);
    for(ll i=0; i<q; i++){
        std::cin >> b[i] >> c[i];
    }

    for(ll i=0; i<q; i++){
        sumed = sumed - b[i]*v[b[i]] + c[i]*v[b[i]];
        std::cout << sumed << "\n";
        v[c[i]] += v[b[i]];
        v[b[i]] = 0;
    }
    return 0;
}


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

int main()
{
    string S;
    cin >> S;
    int count = 0;
    if(S[0] == S[1])
        count++;
    if(S[0] == S[2])
        count++;
    if(S[0] == S[3])
        count++;
    if(S[1] == S[2])
        count++;
    if(S[1] == S[3])
        count++;
    if(S[2] == S[3])
        count++;
    if(count == 2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

int main() {
	 int N, M, C;
	 cin >> N >> M >> C;
	 int B[M];
	 vector <vector <int>> A(N, vector <int> (M));
	 for (int i=0; i<M; i++) cin >> B[i];
	 for (int i=0; i<N; i++){
	     for (int j=0; j<M; j++){
	         cin >> A[i][j];
	     }
	 }
	 int count=0;
	 for (int i=0; i<N; i++){
	     int ans=0;
	     for (int j=0; j<M; j++){
	         ans+=A[i][j]*B[j];
	     }
	     if (ans+C>0) count++;
	 }
	 cout << count << endl; 
}

Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

flag = [True]*n
t = a[0]
ans = 1
while t != 2:
  if flag[t-1]:
    flag[t-1] = False
    t = a[t-1]
    ans += 1
  else:
    print(-1)
    exit()
print(ans)

Measured memory_bytes: 13700
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define forn for(int i=0;i<n;i++)
#define form for(int j=0;j<m;j++)
#define pb push_back
#define mp make_pair
#define sc second
#define f first
#define kek cout<<"\n"
#define all(v)        ((v).begin()), ((v).end())
#define pob pop_back()
const ll MOD=1e9+7;
const int INF=1e8;
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
int a,b;
  cin>>a>>b;
  if(a>b)
  {
            for(int i=0;i<a;i++) cout<<b;
  }
  else  for(int i=0;i<b;i++) cout<<a;
  return 0;
}

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

int main(void)
{
	int a, c, d, e;
	while (cin>>c>>d>>e){
		a = 0;
		for (int i = 1; i <= 10; i++){
			if (c != i && d != i && e != i && c+d+i <= 20) a++;
		}
		if (3 < a) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int) (n); i++)
using namespace std;
using namespace std;
typedef long long ll;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  map<int, int> rest_count;
  REP(i, N) {
    scanf("%d", &A[i]);
    rest_count[A[i]]++;
  }
  sort(A.begin(), A.end(), greater<int>());
  int res = 0;
  REP(i, N) {
    if (rest_count[A[i]] == 0) {
      continue;
    }
    for (int t = 30; t >= 0; t--) {
      int target = (1 << t) - A[i];
      if (target <= 0) break;
      if ((target != A[i] && rest_count[target] > 0 ) || rest_count[target] > 1) {
        res++;
        rest_count[target]--;
        rest_count[A[i]]--;
        break;
      }
    }
  }
  cout << res << endl;
}


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

bool ok;
int a[10];

void dfs(int i, int left, int right) {
  if(i == 10) {
    ok = true;
    return;
  }
  if(left < a[i]) dfs(i + 1, a[i], right);
  if(right < a[i]) dfs(i + 1, left, a[i]);
}

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

  int n;
  cin >> n;
  for(int i = 0; i < n; ++i) {
    for(int j = 0; j < 10; ++j) {
      cin >> a[j];
    }

    ok = false;
    dfs(0, 0, 0);
    if(ok) cout << "YES\n";
    else cout << "NO\n";
  }
}


Measured memory_bytes: 3004
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define maxe max_element
#define mine min_element
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define SIZE 5000 + 1
const ll MAX=1e9;
const ll mod=998244353;
ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}


void solve()
{

 ll a,b,c,d;
 cin>>a>>b>>c>>d;
 ll gg=1;
 while(1)
 {
     if(gg==1)
     {
         if(c<=b)
           {

           cout<<"Yes";return;}
         else
            c-=b;
         gg=0;
     }
     else
     {
         //debug2(a,d);
         if(a<=d)
            {cout<<"No"<<endl;return;}
         else
            a-=d;
         gg=1;
     }
 }

}

int main()
{
  boost;
  ll t=1;
 // cin>>t;
  while(t--)
  {
      solve();
  }
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
const int nMax=2000001, MOD=1e9+7;
ULL inv[nMax], Fact[nMax], invF[nMax];
ULL Comb(int n, int r){ return (((Fact[n]*invF[r])%MOD)*invF[n-r])%MOD; }

int main(){
inv[1]=Fact[0]=Fact[1]=invF[0]=invF[1]=1;
for(int i=2; i<nMax; i++){ 
  inv[i]=((MOD-MOD/i)*inv[MOD%i])%MOD;
  Fact[i]=(Fact[i-1]*i)%MOD; invF[i]=(invF[i-1]*inv[i])%MOD;
}
int X, Y, A, B, ans=0; cin >> X >> Y; int K=abs(Y-X);
if(X<=Y){ A=X-K; B=Y-2*K; }else{ A=Y-K; B=X-2*K; }
if(A==B&&A%3==0&&A>=0){ ans=Comb(2*A/3+K, A/3); }
cout << ans << "\n";  
}


Measured memory_bytes: 47104
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define rep(i, x, n) for(int i = (x); i < (n); i++)
#define rrep(i, x, n) for(int i = (x); i >= (n); i--)
#define int long long
#define endl "\n"
#define mod 1000000007
#define mxx 100005
#define pb push_back
#define vll vector<long long>
#define vs vector<string>
#define pll pair<long long, long long>
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
int fact[1000005];
void factorial(){
	fact[0] = 1;
	rep(i, 1, 1000002)fact[i] = (fact[i-1]*i) % mod;
}

int power(int a, int b ,int m){
	int res = 1;
	a = a % m;
	while ( b > 0){
	if (b & 1) res = (res * a) % m;
	b = b>>1;
	a = (a * a) % m;
	}
	return res % m;
}

int mod_in(int n){
	return ( power(n, mod-2,mod) % mod);
}

int ncr(int n, int r){
	return ( fact[n] * ((mod_in(fact[r]) * mod_in(fact[n-r])) % mod) % mod);
}

class dsu{
	public:
	vll v,size;
	dsu(int n){
		for(int i=0;i<n;i++){
			v.pb(i);
			size.pb(1);
		}
	}
	int par(int a){
		if(v[a]!=a) v[a] =  par(v[a]);
		return v[a];
	}

	int comp(int a,int b) {return par(a)==par(b);}
	
	void unio(int a, int b){
		int pa=par(a);
		int pb=par(b);
		if(pa!=pb){
			if(size[pb]>size[pa]) swap(pa,pb);
			v[pb]=pa;
			size[pa]+=size[pb];
		}
	}
};


signed main()
{
	int t=1;
	// cin >> t;
	while(t--){
		int n,x,t;
		cin >> n >> x >> t;
		int ans= (n/x)*t;
		if(n%x) ans+=t;
		cout << ans << endl;
	}
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
struct UnionFind {
  /*
  UnionFind uf(x)で初期化
  root(x) xの根を返す
  unite(x,y) xとyを同一の根にする
  same(x,y) xとyの根が同一ならtrue
  size(x)　集合の大きさを返す*/
  vector<int> d;
  UnionFind(int n) : d(n, -1) {}
  int root(int x) {  // xの根を返す
    if (d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);  // xとyを連結する
    y = root(y);
    if (x == y) return 0;
    if ((d[x] > d[y])) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; }
};
int main() {
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  REP(i, M) {
    int a, b;
    cin >> a >> b, a--, b--;
    uf.unite(a, b);
  }
  unordered_map<int, int> uo;
  REP(i, N) { uo[uf.root(i)]++; }
  int mx = -1;
  for (auto s : uo) {
    mx = max(mx, s.second);
  }
  cout << mx << endl;
}


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

//the answer must be bountry * bountry
public class Main  {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        String S = next();
        String T = next();
        
        int ans = Integer.MAX_VALUE;

        for (int i=1; i<=S.length()-T.length()+1; i++) {
             String temp = S.substring(i-1, i-1+T.length());
             int count = 0;
             for (int j=1; j<=T.length(); j++) {
                if(!temp.substring(j-1,j).equals(T.substring(j-1,j))){
                    count ++;
                }
             };  
             
             ans = Math.min(ans, count);
        }

        System.out.println(ans);
 
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}


Measured memory_bytes: 51204