akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include<string>


using namespace std;


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

	long long ans = 0;
	long long pattern = 1;
	long long dp = (S[0] - '0');

	for (int i = 1; i < S.size(); i++)
	{
		int num = S[i] - '0';
		ans += dp << (S.size() - i - 1);
		pattern *= 2;
		dp = dp * 10 + num * pattern;
	}
	ans += dp;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s,t;
    cin>>n>>s>>t;
    for(int i=0;i<n;i++){
        cout <<s[i]<<t[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    agc027a()
}

fun agc027a() {
    val (n, x) = readLine()!!.split(' ').map { it.toLong() }
    val aList = readLine()!!.split(' ').map { it.toLong() }
        .sorted().toLongArray()

    var remain = x
    var answer = 0L
    for (a in aList) {
        if (a <= remain) {
            remain -= a
            answer++
        } else break
    }

    if (answer == 0L) return println(0)

    if (answer == n && remain > 0) answer--

    println(answer)
}


Measured memory_bytes: 37900
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  REP(i,N)cin>>A[i];
  int prev=0;
  lint ans=0;
  REP(i,N){
    if(prev and A[i]){
      A[i]++;
    }
    ans+=A[i]/2;
    prev=A[i]%2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,T,A;
  cin >> N >>T >>A;
  
  vector<int> H(N),dT(N);
  for (int i=0;i<N;i++){
    cin >> H.at(i);
    dT.at(i)=abs(1000*T-H.at(i)*6-1000*A);
  }
  
  
  int c=1;
  int dTmin=dT.at(0);
  
  for (int i=1;i<N;i++){
    if(dT.at(i)<dTmin){
      dTmin=dT.at(i);
      c=i+1;
    }
  }  
  cout <<c<<endl;
}


Measured memory_bytes: 256
#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;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    string s; cin>>s;
    if (s[0] == s[1] && s[1] == s[2] && s[2]==s[0]) cout << "No" << '\n';
    else cout << "Yes" << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream> //! 使用 flag 的冒泡排序

using namespace std;

const int N = 1e2 + 10;

int n, a[N];

int bubble_sort(int a[], int n)
{
    int sw = 0;
    bool flag = true;

    for(int i = 0; flag; i++)
    {
        flag = false;
        for(int j = n - 1; j >= i + 1; j--)
        {
            if(a[j] < a[j - 1]) //! 换了就证明前面不是有序的
            {
                swap(a[j], a[j - 1]);
                flag = true;
                sw++;
            }
        }
    }

    return sw;
}

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

    cin >> n;

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

    int sw = bubble_sort(a, n);

    for(int i = 0; i < n; i++)
    {
        if(i > 0) cout << ' ';
        cout << a[i];
    }

    cout << endl;

    cout << sw << endl;

    return 0;
}


Measured memory_bytes: 3144
n = int(input())
a = list(map(int,input().split()))
x = {}
ans = 0
for i in range(n):
    R = i + a[i]
    if not R in x:
        x[R]=1
    else: x[R]+=1
    
for i in range(n):
    L = i - a[i]
    if L in x:
        ans+=x[L]
print(ans)

Measured memory_bytes: 40480
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<deque>
#include<functional>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<string>
#include<vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long ll;

using namespace std;

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

	int N, K;
	int sum = 1;
	int i;
	cin >> N >> K;
	REP(i, N) {
		if (sum < K)sum *= 2;
		else sum += K;
	}
	cout << sum << endl;
}

Measured memory_bytes: 3576
from heapq import heappop,heappush
def solve(n,klr):
  kk=[(-1,-1)]
  for k,l,r in klr:kk.append((k-1,r-l))
  kk.sort()
  h=[]
  ans=0
  for i in range(n-1,-1,-1):
    while kk[-1][0]>=i:heappush(h,kk.pop()[1])
    if len(h):ans-=heappop(h)
  return ans

for _ in range(int(input())):
  n=int(input())
  klr=[list(map(int,input().split()))for _ in range(n)]
  pk=[]
  mk=[]
  ans=0
  for i in range(n):
    k,l,r=klr[i]
    ans+=min(l,r)
    if l>=r:pk.append(i)
    else:mk.append(i)
  l=len(pk)
  for i in mk:
    klr[i][0]=n-klr[i][0]
    klr[i][1],klr[i][2]=klr[i][2],klr[i][1]
  ans+=solve(len(pk),[klr[i]for i in pk])+solve(len(mk),[klr[i]for i in mk])
  print(ans)

Measured memory_bytes: 132740
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

long z(long A,long B);

int main(void){
  long A,B,C,D,i,j,ans,f,e,g,h,k,l,t;
  
  if(scanf("%ld %ld %ld %ld",&A,&B,&C,&D)>4){
    exit(0);
  }
  f=0;
  h=0;
  l=0;
  t = z(C,D);
  //printf("%ld",t);
  e=(B/t)-(A/t);
  f=e;
   if((A%t)<0.1){
     f=f+1;
  }
 if((B%t)<0.1){
   //f=f+1;
  }
  g=(B/C)-(A/C);
  h=g;
  if((B%C)<0.1){
    //h=h+1;
  }
   if((A%C)<0.1){
   h=h+1;
  }
  k=(B/D)-(A/D);
  l=k;
   if((B%D)<0.1){
     //l=l+1;
  }
 if((A%D)<0.1){
   l=l+1;
  }
  ans=(B-A+1)+f-h-l;
  printf("%ld",ans);
  return 0;
}

long z(long A,long B){
  long a,b,x,tmp,r;

  a=A;
  b=B;
  x = a * b;
  
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
  /* 最小公倍数を出力 */
  return x/b;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    
        var sc = new Scanner(System.in);
    
        char c = sc.next().charAt(0);
        
        if('a' <= c && c <= 'z'){
            System.out.println("a");
        }else{
            System.out.println("A");
        }
    }
}

Measured memory_bytes: 35704
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;

int main() {
    int n, m; cin >> n >> m;
    string b;
    vector<int> cnt01(2);
    for (int i = 0; i < n; i++) {
        char bi; cin >> bi; b += bi; cnt01[bi - '0']++;
    }
    vector<int> p(m);
    for (int &pi: p) cin >> pi;
    int cnt = INF;
    for (int t0: {0, 1}) {
        int t = t0;
        string nxt = "";
        vector<int> tmp01(2);
        for (int i = 0; i < m; i++) {
            nxt += string(p[i], '0' + t);
            tmp01[t] += p[i];
            t ^= 1;
        }
        if (tmp01[0] != cnt01[0] || tmp01[1] != cnt01[1]) continue;
        string cur = b;
        int tmp = 0;
        for (int i = 0; i < n; i++) if (cur[i] != nxt[i]) {
            int it = i;
            while (cur[it] != nxt[i]) it++;
            tmp += it - i;
            swap(cur[it], cur[i]);
        }
        cnt = min(cnt, tmp);
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3204
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    else:
        return gcd(y,x%y)
    
H,W,T=map(int,input().split())
mod=10**9+7

h=gcd(H,T)
w=gcd(W,T)
H//=h
W//=w

ans=pow(2,H,mod)+pow(2,W,mod)+pow(2,gcd(H,W),mod)-3
print(pow(ans,h*w,mod))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    int N;
    cin >> N;
    long long ans = 1;
    for(int i = 1; i <= N; i++){
        ans = ans * i % 1000000007;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
l, r = 0, N

def pow_mod(a, b, m):
  ab = 1
  for _ in range(b):
    ab = (ab * a) % m
  return ab

def c2n(c):
  return ord(c) - 97

def hash(s, B, H):
  sh = 0
  for c in s:
    sh = (sh * B + c2n(c)) % H
  return sh

def t(n):
  B, H = 10 ** 8 + 7, 2 ** 64

  if n*2 > N:
    return False
  s, t = S[:n], S[n:n*2]
  sh, th = hash(s, B, H), hash(t, B, H)
  if sh == th:
    return True
  ss = set([sh])
  Bn = pow_mod(B, n, H)
  for i in range(0, N-2*n):
    sh = (sh * B - c2n(S[i]) * Bn + c2n(S[i+n])) % H
    th = (th * B - c2n(S[i+n]) * Bn + c2n(S[i+2*n])) % H
    ss.add(sh)
    if th in ss:
      return True
  return False

while l+1<r:
  m = (l+r)//2
  if t(m):
    l=m
  else:
    r=m

print(l)

Measured memory_bytes: 3444
import java.util.*;

public class Main {
  static long MOD = (long)Math.pow(10, 9) + 7;
  static long ans = 1;
  static ArrayList[] tree;
  static long[] kai;
  static long k;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    k = sc.nextLong();
    tree = new ArrayList[n + 1];
    for(int i = 1; i < n + 1; i++) {
      tree[i] = new ArrayList<Integer>();
    }
    for(int i = 0; i < n - 1; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      ArrayList<Integer> ta = tree[a];
      ArrayList<Integer> tb = tree[b];
      ta.add(b);
      tb.add(a);
      tree[a] = ta;
      tree[b] = tb;
    }
    kai = new long[100001];
    kai[0] = 1;
    for(long i = 1; i < 100001; i++) {
      kai[(int)i] = (kai[(int)i - 1] * i) % MOD;
    }
    ans = k;
    dfs(1, 0);
    System.out.println(ans);
  }

  public static void dfs(int now, int from) {
    ArrayList<Integer> list = tree[now];
    long x = list.size();
    if(now > 1) x--;
    long t = 1;
    if(now > 1) t = kai[(int)k - 2];
    if(now == 1) t = kai[(int)k - 1];
//    long t1 = kai[(int)x];
    long t2 = 1;
    if((k - 1) >= x) {
    if(now > 1) {
      if((k - 2) >= x) {
        t2 = kai[(int)(k - 2 - x)];
      } else {
        ans = 0;
      }
    }
    if(now == 1) t2 = kai[(int)(k - 1 - x)];
//    t1 = func(t1, MOD - 2);
    t2 = func(t2, MOD - 2);
    t = (t * t2) % MOD;
//    t = (t * t2) % MOD;
    ans = (ans * t) % MOD;
    for(int i = 0; i < list.size(); i++) {
      int g = list.get(i);
      if(g != from) dfs(g, now);
    }
    } else {
      ans = 0;
    }
  }

  public static long func(long a, long x) {
    if(x == 0) return 1;
    if(x % 2 == 0) {
      long t = func(a, x / 2);
      return (t * t) % MOD;
    } else {
      long t = func(a, x / 2);
      t = (t * t) % MOD;
      return (a * t) % MOD;      
    }
  }
}

Measured memory_bytes: 108288
# -*- coding : utf-8 -*-

N = int(input())
L = list(map(int, input().split()))

L.sort()
m = min(L)
M = max(L)

A = []
for i in range(m,M+1):
  k=0
  for j in L:
    k += (j-i)*(j-i)
  A.append(k)
  
print(min(A))

Measured memory_bytes: 3064
Anum, Bnum, Cnum, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

yum = []
for ia in range(Anum):
    for ib in range(Bnum):
        if(ia * ib > K):
            break
        for ic in range(Cnum):
            if(ia * ib * ic > K):
                break
            yum.append(A[ia] + B[ib] + C[ic])
yum.sort(reverse=True)
for k in range(K):
    print(yum[k])


Measured memory_bytes: 112360
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll MOD=1e+9+7;
	ll ans=1;
	int N;
	scan(N);
	int A[100001];
	int count[100001]={};
	int flag=1;
	rep(i,N){
		scan(A[i]);
		count[A[i]]++;
	}
	rep(i,N){
		if(count[i]!=(i==0&&N%2==1 ? 1 : 2*((N-i)%2))) flag=0;
		ans*=max(1,count[i]);
		ans%=MOD;
	}
	if(flag){
		prin(ans);
	}
	else{
		prin(0);
	}
	return 0;
}


Measured memory_bytes: 1024
#include<map>
#include<cmath>
#include<stack>
#include<cstdio>
#include<queue>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
char a,b,c,x,y,z;
int main(){
	scanf("%c%c%c\n%c%c%c",&a,&b,&c,&x,&y,&z);
	if(a==z&&b==y&&c==x)puts("YES");
	else puts("NO");
	return 0;
}

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

#define current (current_water + current_sugar)

using namespace std;

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    A *= 100;
    B *= 100;

    int max_water = 0;
    int max_sugar = 0;
    double max_ratio = -1.0;
    for (int a = 0; a * A <= F; a++) {
        for (int b = 0; a * A + b * B <= F; b++) {
            int current_water = a * A + b * B;
            for (int c = 0; c * C <= F; c++) {
                for (int d = 0; c * C + d * D <= F; d++) {
                    int current_sugar = c * C + d * D;
                    if (current == 0) {
                        continue;
                    } else if (current > F || current_sugar > current_water * E / 100) {
                        break;
                    }

                    double current_ratio = (double) current_sugar / (double) current;
                    if (current_ratio > max_ratio) {
                        max_water = current_water;
                        max_sugar = current_sugar;
                        max_ratio = current_ratio;
                    }
                }
            }
        }
    }

    printf("%d %d\n", max_water + max_sugar, max_sugar);
    return 0;
}


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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n,-1);
  for(int i=0; i<m; ++i) {
    int s, c;
    cin >> s >> c;
    if(x[s-1] == -1 || x[s-1] == c) {
      x[s-1] = c;
    } else {
      cout << -1 << '\n'; return;
    }
  }

  if(n != 1 && x[0] == 0) {
    cout << -1 << '\n'; return;
  }

  for(int i=1; i<n; ++i) {
    if(x[i] == -1) x[i] = 0;
  }
  if(x[0] == -1 && n > 1) x[0] = 1; 
  else if(x[0] == -1) x[0] = 0;
  
  for(int i=0; i<n; ++i) cout << x[i];
  cout << '\n';
}

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

  return 0;
}


Measured memory_bytes: 3624
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 1000006
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    FASTIO;
    int n;
    cin>>n;
    ll sum = 0;
    for(int i = 1; i <= n; i++)
    {
        if(i%3==0 && i%5==0)
            continue;
        else if(i%3==0)
            continue;
        else if(i%5==0)
            continue;
        else
            sum+=(ll)i;
    }
    cout<<sum<<endl;

    //End();
    return 0;
}


Measured memory_bytes: 3656
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

class UnionFind {
  public:
    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y])
            swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

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

    int N, M;
    cin >> N >> M;
    vector<int> p(N);

    rep(i, N) {
        cin >> p[i];
        p[i]--;
    }

    UnionFind tree(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        tree.merge(a, b);
    }

    int ans = 0;
    rep(i, N) {
        if (tree.issame(i, p[i]))
            ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 5240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

pair<int, int> store[100007];

int main()
{
    int n;
    ll k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &store[i].first, &store[i].second);
    }

    sort(store, store+n);

    ll cnt = 0;
    for (int i = 0; i < n; i++) {
        cnt += store[i].second;

        if (cnt >= k) {
            cout << store[i].first << "\n";
            break;
        }
    }
}


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

using namespace std;

int main(){
    int s,num;
    cin>>s;
    vector<int> a(1000001);
    int tmp=s;
    a[tmp]++;
    for(int i=1;;i++){
        if(tmp%2==0)
            tmp/=2;
        else
            tmp= 3*tmp+1;

        a[tmp]++;
        if(a[tmp]==2){
            cout<<i+1;
            return 0;
        }
    }
}

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

using namespace std;

typedef long long ll;

function<void(vector<ll> &node, ll v, int k, int l, int r)> 
cpnode=[]    (vector<ll> &node, ll v, int k, int l, int r)
{ node[k]=(r-l+1)*v; };

function<void(vector<ll> &node, int k)> 
mgnode=[]    (vector<ll> &node, int k)
{ node[k]=node[2*k+1]+node[2*k+2]; };

function<ll(ll lv, ll rv)> 
getnode=[] (ll lv, ll rv)
{ return lv+rv; };

struct lst
{
private:
    int n;
    vector<ll> node;
    vector<ll> lazy;
    vector<bool> lflg;
    function<void(vector<ll> &node, ll v, int k, int l, int r)> cpnode;
    function<void(vector<ll> &node, int k)> mgnode;
    function<ll(ll lv, ll rv)> getnode;

    void lazy2node(int k, int l, int r)
    {
        if(lflg[k])
        {
            cpnode(node, lazy[k], k, l, r);
            prop(lazy[k], k, l, r);
            lazy[k]=0;
            lflg[k]=false;
        }
    }

    void prop(ll v, int k, int l, int r)
    {

        if(r-l>0)
        {
            lazy[2*k+1]=lazy[2*k+2]=v;
            lflg[2*k+1]=lflg[2*k+2]=true;
        }
    }

public:
    lst(int sz, 
        function<void(vector<ll>&, ll, int, int, int)>cpnode,
        function<void(vector<ll>&, int)>mgnode,
        function<ll(ll, ll)>getnode)
    : n(1), cpnode(move(cpnode)), mgnode(move(mgnode)), getnode(move(getnode))
    {
        while(n<sz) n*=2;
        node.resize(2*n-1, 0);
        lazy.resize(2*n-1, 0);
        lflg.resize(2*n-1, false);
    }
    void update(int qa, int qb, ll v, int k=0, int l=0, int r=-1)
    {
        if(r<0) r=n-1;
        lazy2node(k, l, r);
        if(qb<l || r<qa) return; 
        if(qa<=l && r<=qb)
        {
            cpnode(node, v, k, l, r);
            prop(v, k, l, r);
        }
        else
        {
            int m=(l+r)/2;
            update(qa, qb, v, 2*k+1, l, m);
            update(qa, qb, v, 2*k+2, m+1, r);
            mgnode(node, k);
        }
    }

    ll get(int qa, int qb, int k=0, int l=0, int r=-1)
    {
        if(r<0) r=n-1;
        lazy2node(k, l, r);
        if(qb<l || r<qa) return 0;
        if(qa<=l && r<=qb) return node[k];
        else
        {
            int m=(l+r)/2;
            ll lv=get(qa, qb, 2*k+1, l, m);
            ll rv=get(qa, qb, 2*k+2, m+1, r);
            return getnode(lv, rv);
        }
    }
};

int main()
{
    int n, q;
    scanf("%d %d", &n, &q);
    lst tree=lst(n, cpnode, mgnode, getnode);
    for(int i=0; i<q; i++)
    {
        int c;
        scanf("%d", &c);
        if(c)
        {
            int s, t;
            scanf("%d %d", &s, &t);
            printf("%lld\n", tree.get(s,t));
        }
        else
        {
            int s, t, v;
            scanf("%d %d %d", &s, &t, &v);
            tree.update(s,t, (ll)v);
        }
    }
    return 0;
}


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

int main(void)
{
    vector<int> a;
    int s;
    cin >> s;
    a.push_back(s);
    int i;
    for (i = 2;i <= 1000000;i++)
    {
        int an = (a.back() % 2 == 0)? a.back() / 2 : 3 * a.back() + 1;
        auto re = find(a.begin(), a.end(), an);
        if(re != a.end()) break;
        a.push_back(an);
    }

    cout << i << endl;
    
    return 0;
}


Measured memory_bytes: 3628
n, x = map(int, input().split())
res = 0
dat = list(map(int, input().split()))

dat.sort()

for i in range(n):
    if x >= dat[i]:
        res += 1
        x -= dat[i]
    else:
        break
if x != 0 and res != 0 and res == n:
    res -= 1
print(res)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
  	cin>>a>>b>>c;
  	if ((a<c && c<b)||(a>c && c>b)){
    	cout<<"Yes"<<endl;
    }else{
    	cout<<"No"<<endl;
    }
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll i;
    ll l[N],r[N];
    ll A;
    for(i=0;i<N;i++){
        l[i]=0;
        r[i]=0;
    }
    for(i=0;i<N;i++){
        cin >> A;
        if(i+A<N)++r[i+A];
        if(i-A>=0)++l[i-A];
    }
    ll ans=0;
    for(i=0;i<N;i++){
        ans+=l[i]*r[i];
    }
    cout << ans;
    return 0;
}


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

string a="snuke",b="ABCDEFGHIJKLMNOPQRSTUVWXYZ",c;
int n,m;

int main()
{
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++)
        for(int j=0;j<m;j++)
        {
            cin>>c;
            if(c==a)
            {
                cout<<b[j]<<i<<endl;
                return 0;
            }
        }
    return 0;    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int N, i;
    scanf("%d", &N);
    for (i = 1; i <= 9; ++i) {
        if (N <= 111 * i) {
            printf("%d", 111 * i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for(int i=(a);i<(b);++i)
#define foreach(i, n) for (__typeof(n.begin()) i = n.begin(); i != n.end(); ++i)
#define sqr(x) ((x)*(x))
#define clr(a, b) memset(a, b, sizeof(a))
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)a.size())
#define all(a) (a).begin(),(a).end()
#define inf 0x3f3f3f3f
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
const double eps = 1e-8;
int dcmp(double x) { if (x < -eps) return -1; else return x > eps;}
#define se(x) cout<<#x<<" = "<<x<<endl

#ifdef CHEN_PC
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...)
#endif

const int N = 100010;
const int mod = 1000000007; // 10^9+7
int n;
pair<ll, int> d[N];
int pnt[N];
int cnt[N];
map<ll, int> dic;

int solve() {
    dic.clear();
	sort(d, d + n);
	forn (i, n) {
		pnt[i] = -1;
		cnt[i] = 1;
		dic[ d[i].first ] = i;
	}
	ll dd = 0;
	for (int i = n - 1; i > 0; --i) {
	    dd += cnt[i];
		int delta = n - cnt[i] * 2;
		ll val = d[i].first - delta;
		if (delta == 0 || dic.find(val) == dic.end()) {
			puts("-1");
			return 0;
		}
		pnt[i] = dic[val];
		cnt[ pnt[i] ] += cnt[i];
	}
//    debug("--- %d\n", dd);
	if (dd != d[0].first) {
	    puts("-1");
	    return 0;
	}
	forn (i, n) {
		if (pnt[i] == -1) {
			continue;
		}
		int u = d[i].second;
		int v = d[pnt[i]].second;
		printf("%d %d\n", v, u);
	}
	return 1;
}

int main(int argc, char *argv[]) {
#ifdef CHEN_PC
	freopen("F.in", "r", stdin);
#endif

	while (scanf("%d", &n) != EOF) {
		forn (i, n) {
		    ll tmp;
			scanf("%lld", &tmp);
			d[i] = MP(tmp, i + 1);
		}
		int ret = solve();
//		printf("%d\n", ret);

#ifdef CHEN_PC
        puts("");
#endif

	}
	return 0;
}



Measured memory_bytes: 9984
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

using ipair = pair<int, int>;

ll INF = 1e16+7;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}

int mod = 1e9+7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
 
 // nのpow_num乗を返す 
mint mint_choose(int n, int pow_num){
  // 分子
  mint nume = mint(1); 
  rep(i, pow_num){
    nume *= (n - i);
  }

  // 分母
  mint deno = 1;
  rep(i, pow_num){
    deno *= (pow_num-i);
  }
  
  return nume/deno;
}


int main(){
  ll X, Y;
  cin >> X >> Y;

  if((2*X-Y)%3 != 0 || (-X+2*Y)%3 !=0){
    cout << 0 << endl;
    return 0;
  }

  ll a = (-X+2*Y) / 3;
  ll b = (2*X-Y) / 3;

  if(a < 0 || b < 0){
    cout << 0 << endl;
    return 0;
  }
  
  cout << mint_choose(a+b, a).x << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

vector<ll> color(100001);
vector<vector<pair<ll,ll>>> bri(100001);

void dfs(ll now,ll col){
    if(color[now]!=0){
        return;
    }
    color[now]=col;
    for (auto it : bri[now])
    {
        if(it.SE%2==0){
            dfs(it.FI,col);
        }else{
            
            dfs(it.FI,3-col);
        }
    }
    
}


void solve(long long N, std::vector<long long> u, std::vector<long long> v, std::vector<long long> w){
    dfs(0,2);
    rep(i,N){
        op(color[i]-1); 
    }
    /*rep(i,N){
        for(auto it : bri[i])cout<<i<<" "<<it.FI<<" "<<it.SE<<endl;
    }*/
}

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


Measured memory_bytes: 12416
def a():
    n, k = map(int, input().split())
    if int(n / 2 + 0.5) >= k:
        print("YES")
    else:
        print("NO")


def B():
    root = [[0 for i in range(4)] for j in range(4)]
    for i in range(3):
        a, b = map(int, input().split())
        #print(a, b)
        root[a - 1][b - 1] = 1
        root[b - 1][a - 1] = 1

    cnt_one = 0
    cnt_two = 0
    for i in range(4):
        if sum(root[i]) == 1:
            cnt_one += 1
        if sum(root[i]) == 2:
            cnt_two += 1
    if cnt_one == 2 and cnt_two == 2:
        print("YES")
    else:
        print("NO")

B()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int H, W, D, Q;
    cin >> H >> W >> D;
    vector<vector<int>> A(H, vector<int>(W));
    vector<pair<int, int>> pa(W * H);
    rep(i, 0, H){
        rep(j, 0, W){
            cin >> A.at(i).at(j);
            pa.at(A.at(i).at(j) - 1) = make_pair(i, j);
        }
    }
    cin >> Q;
    vector<int> L(Q), R(Q);
    rep(i, 0, Q){
        cin >> L.at(i) >> R.at(i);
    }
    vector<int> S_cost(H * W);
    for (int k = 0; k < D; k++){
        int fin = H * W - k; // Li, Riのありうる最大
        int num = (fin + D - 1) / D; // Li, Ri候補の数
        //cout << fin << " " << num << endl;
        
        S_cost.at(fin - 1) = 0;
        for (int j = 1; j < num; j++){
            int x_1 = pa.at(fin - D * (j - 1) - 1).second;
            int y_1 = pa.at(fin - D * (j - 1) - 1).first;
            int x_0 = pa.at(fin - D * j - 1).second;
            int y_0 = pa.at(fin - D * j - 1).first;
            int cost = abs(x_1 - x_0) +abs(y_1 - y_0);
            S_cost.at(fin - D * j - 1) = S_cost.at(fin - D * (j - 1) - 1) + cost;
        }
         
    }
    /*
    rep(i, 0, H * W){
        cout << S_cost.at(i) << endl;
    }
    */

    rep(i, 0, Q){
        cout << S_cost.at(L.at(i) - 1) - S_cost.at(R.at(i) - 1) << endl;
    }
}

Measured memory_bytes: 3328
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	int N;
	long A,B;
	int[] h,hh;

	private boolean check(int x){

		long b = 1L * B * x;

		if(b >= (int)1e9+7)return true;

		long cntA = 0;

		hh = new int[N];
		for(int i = 0;i < N;i++){
			hh[i] = h[i] - (int)b;
		}

		for(int i = 0;i < N;i++){
			if(hh[i] > 0){
				cntA += hh[i] / (A-B) + (hh[i]%(A-B) > 0 ? 1 : 0);
			}
		}

		return cntA <= x;
	}

	public void solve() {
		N = nextInt();
		A = nextInt();
		B = nextInt();

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


		int low = 0;
		int high = (int)1e9+7;

		while(high-low>1){

			int mid = high+low >> 1;
			if(check(mid)){
				high = mid;
			}else{
				low = mid;
			}
		}

		out.println(high);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

Measured memory_bytes: 43280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int num = scanner.nextInt();
		int result = 0;

		for(int i = 1; i <= num; i++) {
			result += i;
		}

		System.out.println(result);

		scanner.close();

	}

}


Measured memory_bytes: 21204
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            (int N, int K, int C) = Slice3<int>();
            var S = ReadLine();
            var dp = new int[2, K];
            for (var i = 0; i < 2; ++i)
            {
                var now = 0;
                var cnt = 0;
                while (cnt < K)
                {
                    if (S[now] == 'o')
                    {
                        dp[i, cnt++] = now;
                        now += C + 1;
                    }
                    else
                        ++now;
                }
                S = string.Join("", S.Reverse());
            }
            for (var i = 0; i < K; ++i)
                if (dp[0, i] == N - 1 - dp[1, K - 1 - i])
                    WriteLine(dp[0, i] + 1);
            WriteLine();
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  ll h, w;
  int n;
  cin >> h >> w >> n;

  map<pii, int> mp;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = 0; j < 3 && a - j >= 1; j++) {
      for (int k = 0; k < 3 && b - k >= 1; k++) {
        mp[pii(a - j, b - k)]++;
      }
    }
  }

  vector<ll> ans(10);
  ll all = (h - 2) * (w - 2);
  for (auto i : mp) {
    pii p = i.first;
    if (p.first >= 1 && p.first <= h - 2 && p.second >= 1 && p.second <= w - 2) {
      ans[i.second]++;
      all--;
    }
  }
  ans[0] = all;

  for (int i = 0; i < 10; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

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

using ll=long long; 

void solve(){
	int n,l;
	cin>>n>>l;
	vector<string > s(n);
	for(auto& e:s)cin>>e;
	sort(s.begin(), s.end());
	for(auto& e:s)cout<<e;
	cout<<endl;
}

signed main(){
	//while(1)
	solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
    ll x;
    explicit mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint& a) { if ((x += a.x) >= mod) x -= mod; return *this;}
    mint& operator++() { x += 1; return *this;}
    mint& operator-=(const mint& a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator--() { x -= 1; return *this;}
    mint& operator*=(const mint& a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint& a) const { mint res(*this); return res+=a; }
    mint operator-(const mint& a) const { mint res(*this); return res-=a; }
    mint operator*(const mint& a) const { mint res(*this); return res*=a; }
    bool operator==(const int& n) const { mint a(n); return this->x == a.x; }
    bool operator==(const ll& n) const { mint a(n); return this->x == a.x; }
    bool operator!=(const int& n) const { mint a(n); return this->x != a.x; }
    bool operator!=(const ll& n) const { mint a(n); return this->x != a.x; }
    mint pow(ll t) const {
        mint res = mint(1),a(*this);
        while(t > 0) {
            if(t&1) res *= a;
            t >>= 1;
            a *= a;
        }
        return res;
    }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint& a) { return (*this) *= a.inv(); }
    mint operator/(const mint& a) const { mint res(*this); return res/=a; }
};
ostream& operator<<(ostream& os,const mint& m) { return os << m.x; }

mint dp[1010][1010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int h,w;
    cin >> h >> w;
    vs a(h);
    cin >> a;
    dp[0][0] = mint(1);
    rep(i,h) rep(j,w) {
        if(a[i][j] == '#') continue;
        if(i+1 < h) dp[i+1][j] += dp[i][j];
        if(j+1 < w) dp[i][j+1] += dp[i][j];
    }
    cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 9344
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <utility>
#include <queue>
#include <tuple>
#include <map>
#include <cmath>
using namespace std;
using ll = long long;
constexpr ll INF = 1000000007;

int main() {
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) {
        cout << "No\n";
    }
    else {
        cout << "Yes\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	int N,K,p,a,count = 0;
  cin >> N >> K;
  vector<int> check(N,0);
  froop1(0,K){
    cin >> p;
      for(int j = 0;j < p;j++){
		cin >> a;
        check.at(a - 1)++;
      }
  }
  froop1(0,N){
    if(check.at(i) == 0){
      count++;
    }
  }
  cout << count << endl;
     return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vectors<decltype(inner)>(x, inner); }
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
int dx[]={0,0,2,-2};
int dy[]={2,-2,0,0};
int _dx[]={0,0,1,-1};
int _dy[]={1,-1,0,0};
int W,H;
bool inrange(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define MP make_pair
signed main(){
    char s,t;
    cin >> H >> W >> s >> t;
    vector<string>grid(H);
    vector<vector<pii>>edge(100);
    map<int,pii>memo;
    rep(i,H) cin >> grid[i];
    rep(i,H)rep(j,grid[i].size()){
        if('A' <= grid[i][j] && grid[i][j] <= 'Z'  ){
            memo[grid[i][j] - 'A'] = MP(j,i);
        }
    }
    for(auto itr : memo){
        int vertex = itr.first;
        pii pos = itr.second;
        rep(i,4){
            pii temp = MP(pos.first+dx[i],pos.second+dy[i]);
            if(!inrange(temp.first,temp.second))continue;
            if(grid[temp.second][temp.first] != '-' && grid[temp.second][temp.first] != '|') continue;
            if(grid[temp.second][temp.first] == '|' && ( i > 1)) continue;
            if(grid[temp.second][temp.first] == '-' && ( i <= 1))continue;
            pii now = temp;
            while(true){
                if('A' <= grid[now.second][now.first] && grid[now.second][now.first] <= 'Z'  )
                    break;
                now.first += _dx[i];
                now.second += _dy[i];
                assert(inrange(now.first, now.second));
            }
            int next =  grid[now.second][now.first] - 'A';
            edge[vertex].push_back(pii(next,1));
        }
    }
    // dijkstra
    vector<int>d(t,INF);
    d[s-'A'] = 0;
    priority_queue<pii,vector<pii>,greater<pii>>que;
    que.push(pii(0,s-'A'));
    while(!que.empty()){
        pii now = que.top();
        que.pop();
        if(now.first > d[now.second])continue;
        rep(i,edge[now.second].size()){
            int next  = edge[now.second][i].first;
            if(d[next] < 1 + now.first) continue;
            d[next] = 1 + now.first;
            que.push(pii(d[next],next));
        }
    }
    cout << d[t-'A'] << endl;
}



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

public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();
		int count = 0;
		for(int i = 1; i <= 100; i++){
			if((d * i >= l) && (d * i <= r))
			count++;
		}
		System.out.println(count);
    }
}

Measured memory_bytes: 35824