akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pi;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep_op(i, a, n) for (int i = a; i < n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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

const int MOD = 1000000007;

const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

using Graph = vector<vector<int>>;

Graph G;

vector<bool> seen;
void dfs(const Graph &G, int v)
{
    seen[v] = true;

    for (auto next_v : G[v])
    {
        if (seen[next_v])
            continue;
        dfs(G, next_v);
    }
}

int main()
{

    ll a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << min({a * b, b * c, c * a}) << endl;
    }
}


Measured memory_bytes: 256
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    LR = ii2nnn(M)
    L, R = 0, int(1e+5)
    for l, r in LR:
        if L < l:
            L = l
        if R > r:
            R = r
    n = R - L + 1
    if n < 0:
        n = 0
    print(n)

main()


Measured memory_bytes: 65628
def main():
    group_A = [1, 3, 5, 7, 8, 10, 12]
    group_B = [4, 6, 9, 11]
    group_C = [2]

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

    x_id = 0
    y_id = 0

    if x in group_A:
        x_id = 1
    elif x in group_B:
        x_id = 2
    elif x in group_C:
        x_id = 3

    if y in group_A:
            y_id = 1
    elif y in group_B:
        y_id = 2
    elif y in group_C:
        y_id = 3

    if x_id == y_id:
        print("Yes")
    else:
        print("No")

main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 10000000000005
#define MOD 1000000007
#define N 300005
#define M 15000005
#define LOG 1000000
#define KOK 650
#define EPS 0.00001
using namespace std;

char s[55];
int ok[555];
int n;

int main() {

	//freopen("input.txt","r",stdin);

//	freopen("ufakgcd.gir","r",stdin);
//	freopen("ufakgcd.cik","w",stdout);

	scanf("%s",s+1);
	n=strlen(s+1);

	if(n==26) {

		char mx=0;

		while(mx<s[n]) {

			ok[s[n]]=1;

			umax(mx,s[n]);

			n--;

		}

		if(!n) {

			printf("-1");

			return 0;

		}

		for(int i=s[n]+1;i<='z';i++) {

			if(ok[i]) {

				s[n]=i;
				s[n+1]='\0';

				break ;

			}

		}

		printf("%s",s+1);

	}
	else {

		for(int i=1;i<=n;i++) ok[s[i]]++;

		for(int i='a';i<='z';i++) {

			if(!ok[i]) {

				s[n+1]=i;

				break ;

			}

		}

		printf("%s",s+1);

	}

}


Measured memory_bytes: 256
#include <iostream>

#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

int find_pivot(int* a, int i, int j){
	int k = i+1;
	while(k <= j && a[i] == a[k]) k++;
	if(k>j) return -1;
	if(a[i] >= a[k]) return i;
	return k;
}

int partition (int* a, int i, int j, int x){
	int l=i, r=j;
	while(l <= r){
		while(l <= j && a[l] < x) l++;
		while(r >= i && a[r] >= x) r--;
		
		if(l > r) break;
		int tmp = a[l];
		a[l] = a[r];
		a[r] = tmp;
		l++;
		r--;
	}
	return l;
}

void quick_sort(int* a, int i, int j){
	if(i == j) return;
	int p = find_pivot(a, i, j);
	if(p != -1){
		int k = partition(a, i, j, a[p]);
		quick_sort(a, i, k-1);
		quick_sort(a, k, j);
	}
}

int main(){
	int n,k;
	cin >> n >> k;
	int h[n];
	long long sum = 0;
	rep(i,n) { cin >> h[i]; sum+=h[i]; }
	
	quick_sort(h, 0, n-1);
	
	for(int i = 0; i < k && i < n; i++){
		sum -= h[n-1-i];
		h[n-1-i] = 0;
	}
	
	cout << sum << endl;
	
}

Measured memory_bytes: 4344
/*ॐॐ*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* “Strength is the only thing that matters in this world. Everything else is just a delusion for the weak.” – Vegeta */

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



ll N;
/*ll freq[200005];*/
void solve(){
   /*memset(freq,0,sizeof(freq));*/
  string s;
  map<string , int> days;
  days["MON"] = 1;
  days["TUE"] = 2;
  days["WED"] = 3 ; days["THU"] = 4; days["FRI"] = 5; days["SAT"] = 6;
  days["SUN"] = 0;

  cin>>s;

  cout<<7-days[s]<<'\n';


   

}



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

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

set<int> P[26];

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    for(int i = 0 ; i < S.size() ; i++){
        P[S[i]-'a'].insert(i);
    }
    for(int i = 0 ; i < 26 ; i++)
        P[i].insert(N);

    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            int x;
            char c;
            cin >> x >> c;
            --x;
            P[S[x]-'a'].erase(x);
            P[c-'a'].insert(x);
            S[x] = c;
        } else {
            int l, r;
            cin >> l >> r;
            --l;
            int ans = 0;
            for(int j = 0 ; j < 26 ; j++){
                ans += *P[j].lower_bound(l) < r;
            }
            cout << ans << endl;
        }
    }
    // Failed to predict input format
    return 0;
}


Measured memory_bytes: 24196
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

ll memo[100][100000];
ll solve(vector<ll>& w, vector<ll>& v, int index, int weight) {
	if(weight < 0) {
		return -INF;
	}
	if(index < 0) {
		return 0;
	}
	if(memo[index][weight]) {
		return memo[index][weight];
	}
	return memo[index][weight] =
			   max(solve(w, v, index - 1, weight - w[index]) + v[index],
				   solve(w, v, index - 1, weight));
}

int main() {
	int n, w_max;
	cin >> n >> w_max;
	vector<ll> w(n);
	vector<ll> v(n);
	REP(i, n) { cin >> w[i] >> v[i]; }
	cout << solve(w, v, n - 1, w_max) << endl;
	return 0;
}


Measured memory_bytes: 74948
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 300

const int INF = 1 << 30;
const int MOD = 1e9 + 7;

ll dp[105][15][1005];

ll dfs(ll rest, ll n, ll s) {

	//restまでの整数のなかで残りn個を選んで和をsにする組み合わせ

	if (rest < 0)
	{
		//0まで見た時
		if (n == 0 && s == 0)
		{
			//和がsになっている場合は組み合わせとして適する
			return 1;
		}
		else
		{
			//n個選んでない場合や和がsになっていない場合
			return 0;
		}
	}
	if (n < 0 || s < 0)
	{
		//もう選べない場合か和が負になる組み合わせはない
		return 0;
	}
	if (dp[rest][n][s] != -1)
	{
		return dp[rest][n][s];
	}

	ll ret = 0;
	ret += dfs(rest - 1, n, s);//数字restを選ばない場合
	ret += dfs(rest - 1, n - 1, s - rest);//数字restを選ぶ場合
	
	return dp[rest][n][s] = ret;
}

int main() {

	ll n, s;
	while (cin >> n >> s, n|s)
	{
		for (int i = 0; i < 105; i++)
		{
			for (int j = 0; j < 15; j++)
			{
				for (int k = 0; k < 1005; k++)
				{
					dp[i][j][k] = -1LL;
				}
			}
		}
		cout << dfs(100, n, s) << endl;
	}


	

	return 0;
}


Measured memory_bytes: 15456
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
using namespace std;
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("outp.txt","w",stdout);
    #endif
   ll d,t,s;
   cin>>d>>t>>s;
    if(s*t>=d)
    cout<<"Yes";
    else
       cout<<"No"; 
}

    


Measured memory_bytes: 3572
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ll k,a;
    cin>>k>>a;
    ll p[a];
    for(ll i=0;i<a;i++){cin>>p[i];}
    sort(p , p+a);
    ll d=0;
    for(ll i=0;i<a-1;i++){	
        d=max(d,p[i+1]-p[i]);}
        
        d=max(d,p[0]+(k-p[a-1]));
        cout<<k-d;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
  static int[] Input(){
    return Console.ReadLine().Split().Select(int.Parse).ToArray();
  }

  static int[][] Input2(int n){
    int[][] X = new int[n][];
    for(int i = 0; i < n; i++){
      X[i] = Input();
    }
    return X;
  }

  static void Main()
  {
    int[] NY = Input();
    for(int i = 0; i <= NY[0]; i++){
      for(int j = 0; j <= NY[0]-i; j++){
        if ((NY[0]-i-j)*1000 + i*5000 + j*10000 == NY[1]){
          Console.WriteLine("{0} {1} {2}", j, i, NY[0]-i-j);
          return ;
      }
      }
    }
    Console.WriteLine("-1 -1 -1");
  }
}


Measured memory_bytes: 13396
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()

    N0 = 2**(N.bit_length())
    st = [0] * (N0*2)

    def gindex(l, r):
        L = l + N0; R = r + N0
        lm = (L // (L & -L)) // 2
        rm = (R // (R & -R)) // 2
        while L < R:
            if R <= rm:
                yield R - 1
            if L <= lm:
                yield L - 1
            L //= 2; R //= 2
        while L > 0:
            yield L - 1
            L //= 2

    def update(i,s):
        x = 2 ** (ord(s) - ord('a'))
        i += N0-1
        st[i] = x
        while i > 0:
            i = (i-1) // 2
            st[i] = st[i*2+1] | st[i*2+2]

    def query(l,r):
        l += N0
        r += N0
        ret = 0

        while l < r:
            if l % 2:
                ret |= st[l-1]
                l += 1
            if r % 2:
                r -= 1
                ret |= st[r-1]
            l //= 2 ; r //= 2

        return ret


    for i,s in enumerate(sys.stdin.readline().rstrip()):
        update(i+1,s)
    Q = NI()
    for _ in range(Q):
        c,a,b = sys.stdin.readline().split()
        if c == '1':
            update(int(a),b)
        else:
            ret = query(int(a),int(b)+1)
            cnt = 0
            b = 1
            for i in range(26):
                cnt += (b & ret) > 0
                b <<= 1
            print(cnt)


if __name__ == '__main__':
    main()

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

struct UnionFind{
    public:
        UnionFind(int n): _n(n), parent_or_size(n, -1){}

        void unite(int a, int b){
            assert(0 <= a && a < _n);
            assert(0 <= b && b < _n);
            int x = root(a), y = root(b);
            if(x == y) return;
            if(-parent_or_size[x] < -parent_or_size[y]) swap(x, y);
            parent_or_size[x] += parent_or_size[y];
            parent_or_size[y] = x;
            return;
        }

        bool same(int a, int b){
            return root(a) == root(b);
        }

        int root(int a){
            if(parent_or_size[a] < 0) return a;
            return parent_or_size[a] = root(parent_or_size[a]);
        }

        int get_size(int a){
            return -parent_or_size[root(a)];
        }

        std::vector<std::vector<int>> groups(){
            std::vector<int> leader_buf(_n), group_size(_n);
            for (int i = 0; i < _n; i++) {
                leader_buf[i] = root(i);
                group_size[leader_buf[i]]++;
            }
            std::vector<std::vector<int>> result(_n);
            for (int i = 0; i < _n; i++) {
                result[i].reserve(group_size[i]);
            }
            for (int i = 0; i < _n; i++) {
                result[leader_buf[i]].push_back(i);
            }
            result.erase(
                std::remove_if(result.begin(), result.end(),
                            [&](const std::vector<int>& v) { return v.empty(); }),
                result.end());
            return result;
        }

    private:
        int _n;
        //root node: -1*component size
        //otherwise: parent
        vector<int> parent_or_size;
};

int main()
{
    ll i,j;
    ll n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        --a;    --b;
        uf.unite(a, b);
    }
    int ans = -1;
    rep(i,n){
        ans = max(ans, uf.get_size(i));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) { 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}
set<pair<int, int>> s;
vector<pair<int, int>> arr;
void solve() {
	int h, n;
	cin >> h >> n;
	int s = 0;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		s += x;
	}
	if (s >= h) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}   

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int r, D, x;
    cin>>r>>D>>x;
    for (int i = 0; i < 10; i++)
    {
        x = x * r - D;
        cout << x << endl;
    }

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

signed main(){
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    printf("%.10f %d\n", w*h/2, w/2 == x && h/2 == y);
}

Measured memory_bytes: 256
MOD=10**9+7
N,K=map(int,input().split())
alist=list(map(int,input().split()))
alist.sort()
#print(alist)

inv_table = [0]+[1]
for i in range(2,N+1):
  inv_table.append(-(MOD//i)*inv_table[MOD%i]%MOD)

min_s,max_s=0,0
old_comb,new_comb=0,1
for i in range(K,N+1):
  #print(K,i,new_comb-old_comb)
  min_s+=(new_comb-old_comb)*alist[-1-(i-1)]
  min_s%=MOD
  max_s+=(new_comb-old_comb)*alist[i-1]
  max_s%=MOD
  
  old_comb=new_comb
  new_comb=old_comb*(i+1)*inv_table[i+1-K]%MOD
#print(min_s,max_s)

print((max_s-min_s)%MOD)

Measured memory_bytes: 14416
#include <stdio.h>

int main(void)
{
	char count[52]={0};
	int i=0;;
	char c;

	while(scanf("%c",&c) != EOF){
		if('a' <= c && c <= 'z'){
			count[c-'a'] ++;
		}
		if('A' <= c && c <= 'Z'){
			count[c-'A'] ++;	
		}
	}
		for(i=0;i<26;i++){
		printf("%c : %d\n",i+'a',count[i]);
	}
	return 0;
}

Measured memory_bytes: 540
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e5
using namespace std;

char dt[1000][1000];
int dp[1000][1000];

int main(){
	int n;
	while(cin>>n,n){
		rep(i,n){
			rep(j,n){
				cin>>dt[i][j];
				if(dt[i][j]=='*')dp[i][j]=0;
				else if(i==0 || j==0)dp[i][j]=1;
				else dp[i][j]=INF;
			}
		}
		loop(i,1,n){
			loop(j,1,n){
				if(dp[i][j]==0)continue;
				dp[i][j]=min(min(dp[i][j-1],dp[i-1][j]),dp[i-1][j-1])+1;
			}
		}
		int ans=0;
		rep(i,n){
			rep(j,n){
				ans=max(ans,dp[i][j]);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 6044
from collections import deque
def main():
  _map, _input, _int = map, input, int
  n, q = _map(_int, _input().split())
  values = [0] * n
  links = [[] for _ in range(n)]
  for _ in range(n - 1):
    a, b = _map(_int, _input().split())
    links[a - 1].append(b - 1)
    links[b - 1].append(a - 1)
  for _ in range(q):
    p, x = _map(_int, _input().split())
    values[p - 1] += x
  d = deque()
  d.append((0, -1))
  while len(d) != 0:
    i, p = d.pop()
    for j in links[i]:
      if j == p:
        continue
      values[j] += values[i]
      d.append((j, i))
  print(*values)
main()

Measured memory_bytes: 62236
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

const int MAX_N = 10000;
Int fact[MAX_N];
Int inv[MAX_N];
Int invfact[MAX_N];

void init(Int n) {
    fact[0] = fact[1] = 1;
    inv[1] = 1;
    invfact[0] = invfact[1] = 1;
    for(Int i = 2;i <= n;i++) {
        fact[i] = (i*fact[i-1]) % MOD;
        inv[i] = MOD - (MOD/i)*inv[MOD % i] % MOD;
        invfact[i] = (inv[i]*invfact[i-1]) % MOD;
    }

    return;
}

Int comb(Int n, Int r) {
    if(n < r)
        return 0;

    return ((fact[n]*invfact[n-r] % MOD) * invfact[r]) % MOD;
}

int main(void) {
    Int N,K;
    cin>>N>>K;

    init(N+K+1);
    for(int i = 1;i <= K;i++) {
        cout<<comb(N-K+1,i)*comb(K-1,i-1) % MOD<<endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1000000007;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mmax=1000009;

int main(void){
    int n;
    string s;
    cin>>n>>s;
    vector<int> lsums(n+1,0),rsums(n+1,0);
    rep(i,n){
        lsums[i+1]=lsums[i];
        if(s[i]=='W') lsums[i+1]++;
    }
    reverse(s.begin(),s.end());
    rep(i,n){
        rsums[i+1]=rsums[i];
        if(s[i]=='E') rsums[i+1]++;
    }
    reverse(rsums.begin(),rsums.end());
    int ans=n;
    rep(i,n){
        int temp=lsums[i]+rsums[i+1];
        //cout<<temp<<endl;
        chmin(ans,temp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6144
# coding:utf-8
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
ds = w - v
dd = abs(b - a)

if ds >= 0:
    print('NO')
    exit()
else:
    ans = dd / ds
    if -(ans) <= t:
        print('YES')
        exit()

print('NO')


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  rep(i,M){
    int k;
    cin >> k;
    //a[i].resize(k);
    rep(j,k){
      int s;
      cin >> s;
      s--;
      a[s] |= 1<< i;
    }
  }
  int ans =0;
  int p=0;
  for(int i=0;i<M;i++){
    int x;
    cin >> x;
    p |= x << i;
  }
  for(int s=0; s<(1<<N) ;s++){
    int t=0;
    for(int i=0;i<N;i++){
      if(s>>i &1){
        t ^= a[i];
      }
    }
  
    if(t==p){
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}

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

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

using ll = long long;
using namespace std;

string shrink(string, int);
bool ok(string);

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

	string t,tp;
	int a[26] = {0}, m = 0;

	cin >> t;
	FOR(i,'a','z'+1){
		string s=t;
		while(!ok(s))
			s = shrink(s, i);
		m = m < s.length() ? s.length() : m;
	}
	cout << t.length() - m << "\n";
	return 0;
}

string shrink(string s, int c){
	REP(i, s.length()-1){
		if(s[i] == c || s[i+1] == c)
			s[i] = (char)c;
	}
	s.pop_back();
	return s;
}

bool ok(string s){
	if(s == "")return true;
	REP(i, s.length()-1){
		if(s[i] != s[i+1])return false;
	}
	return true;
}

Measured memory_bytes: 256
//
//  second.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); i++)
#define rep1(i,n) for(int (i) = 1; (i) <= (int)(n); i++)
#define INF 1000000
#define MOD 998244353



int main()
{
    int X,Y,Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
    
    
    
    
    return 0;
}



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

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	bool f1=true;
	bool f2=true;

	if(n/100>12 or n/100==0)f1=false;
	if(n%100>12 or n%100==0)f2=false;

	if(f1 and f2)cout << "AMBIGUOUS" << endl;
	else if(f1)cout << "MMYY" << endl;
	else if(f2)cout << "YYMM" << endl;
	else cout << "NA" << endl;







}


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

int main(void) {
 while(1) {
   int H, W;
   cin >> H >> W;

   if (H == 0 && W == 0) break;

   for(int i = 0; i < H; i++){
     for(int j = 0; j < W; j++){
       cout << "#";
     }
     cout << "\n";
   }
   cout << "\n";
 }
 return 0;
}


Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}

   

int main(){
lint N,count=0,tmp=1;
cin>>N;
lint X[N];

rep(i,N){
    cin>>X[i];
}
rep(i,N){
    if(X[i]==tmp){
        tmp++;
        continue;
    }
    else {
        count++;
    }
}
if(count==N)count=-1;
cout<<count;

}

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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

auto INF = make_pair('J', 1 << 30);

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

void print(pair<char, int>* A, int n) {
    REP(i, n) {
        cout << A[i].first << " " << A[i].second << endl;
    }
}

int partition(pair<char, int>* A, int p, int r) {
    int pivot = A[r].second;
    int i = p - 1;

    FOR(j, p, r) {
        if(A[j].second <= pivot) {
            ++i;
            swap(A[i], A[j]);
        }
    }
    swap(A[++i], A[r]);

    return i;
}

void quickSort(pair<char, int>* A, int p, int r) {
    if (p < r) {
        int q = partition(A, p, r);
        quickSort(A, p, q-1);
        quickSort(A, q + 1, r);
    }
}

void check_stable(pair<char, int>* sorted, pair<char, int>* original, int left, int right) {

    int index = 0, current_n = 0;
    FOR(i, left, right) {
        auto cur = sorted[i];

        if (cur.second != current_n) {
            current_n = cur.second;
            index = 0;
        }

        FOR(j, left, right) {
            if (cur == original[j]) {
                if (index > j) {
                    cout << "Not stable" << endl;
                    return;
                }

                index = j;
            }
        }
    }

    cout << "Stable" << endl;
    return;
}

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

    int n; cin >> n;

    pair<char, int> D[n];
    REP(i, n) {
        char mark; int num;
        cin >> mark >> num;
        D[i] = make_pair(mark, num);
    }

    // copy deck to check stability
    pair<char, int> D_copy[n] = D;

    quickSort(D, 0, n-1);

    check_stable(D, D_copy, 0, n - 1);

    print(D, n);

}



Measured memory_bytes: 4656
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main() {
    ll n,k;
    std::cin >> n>>k;
    string s;
    std::cin >> s;
    // 端の場合は一人、それ以外は二人
    ll c1 = 0;
    ll c2 = 0;
    if ( s[0] == 'L' ){
        c1++;
    }
    for (int i = 0; i < n; i++) {
        if(i!=n-1){
            if(s[i] == 'R' && s[i+1] == 'L'){
                c2++;
            }
        }else if(i==n-1){
            if (s[i] == 'R'){
                c1++;
            }
        }
    }
    if(c2<k){
        std::cout << n-1 << std::endl;
        return 0;
    }else if(c2 == k){
        if(c1==0){
            std::cout << n-1 << std::endl;
        }else{
            std::cout << n-c1 << std::endl;
        }
    }else{
        std::cout << n-2*(c2-k)-c1 << std::endl;
    }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define fcout cout << fixed << setprecision(15)
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	a *= 60, a += b;
	c *= 60, c += d;
	cout << max(c - a - e, 0LL) << endl;
	return 0;
}

Measured memory_bytes: 3652
#include <cstdio>

int gcd(int a, int b)
{
    return b ? gcd(b, a%b) : a;
}

int e_gcd(int a, int b, int& x, int& y)
{
    if(b == 0)
    {
        x = 1;
        y = 0;
        return a;
    }
    int r = e_gcd(b, a%b, y, x);
    y -= a/b*x;
    return r;

}
int main()
{
    int a, b;
    scanf("%d%d",&a,&b);
    int g = gcd(a, b);
    int x, y;
    e_gcd(a, b, x, y);
    printf("%d %d\n",x, y);
    return 0;
}



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


void solve(){
int h1,m1,h2,m2;
cin>>h1>>m1>>h2>>m2;
int len=(h2-h1-1)*60+(60-m1+m2);
int k;
cin>>k;
cout<<len-k;


}



int main() {


	solve();


}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>

using namespace std;
typedef long long ll;

const long long MOD = 1e9 + 7;
const int K = 700;
const long long INF = 1e9 - 1;

ll n, m;
map<int, int> col[500000];
vector<pair<int, int> > graph[2500000];
ll d[2500000];
deque<int> q;
vector<pair<int, int> > gg;
vector<int> in_city[2500000];
ll r[2500000];
ll vis[2500000];

int main()
{
    vis[1] = 1;
    int id = 1;
    gg.push_back({0, 0});
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        ll p, q, c;
        cin >> p >> q >> c;
        int id1 = 0, id2 = 0;
        if (col[p][c] == 0)
        {
            col[p][c] = id;
            in_city[p].push_back(id);
            r[id] = p;
            gg.push_back({p, c});
            id++;
        }
        if (col[q][c] == 0)
        {
            col[q][c] = id;
            in_city[q].push_back(id);
            r[id] = q;
            gg.push_back({q, c});
            id++;
        }
        id1 = col[p][c];
        id2 = col[q][c];
        graph[id1].push_back({id2, 0});
        graph[id2].push_back({id1, 0});
    }
    for (int i = 1; i <= n; i++)
    {
        for (auto it = col[i].begin(); it != col[i].end(); it++)
        {
            auto it2 = it;
            it2++;
            if (i == 1)
            {
                d[it->second] = 1;
                q.push_back(it->second);
            }
            else
            {
                d[it->second] = INF;
            }
            if (it2 == col[i].end())
                break;
            int id1 = it->second;
            int id2 = it2->second;
            //graph[id1].push_back({id2, 1});
            //graph[id2].push_back({id1, 1});
        }
    }
    //cout << id << endl;

    while (q.size())
    {
        int v = q.front();
        q.pop_front();
        for (int i = 0; i < graph[v].size(); i++)
        {
            int u = graph[v][i].first;
            int w = graph[v][i].second;
            int nw = d[v] + w;
            if (vis[r[u]] == 0)
            {
                vis[r[u]] = 1;
                for (int j = 0; j < in_city[r[u]].size(); j++)
                {
                    d[in_city[r[u]][j]] = nw + 1;
                    q.push_back(in_city[r[u]][j]);
                }
            }
            if (nw >= d[u])
            {
                continue;
            }
            if (w == 0)
            {
                d[u] = nw;
                q.push_front(u);
            }
            else
            {
                d[u] = nw;
                q.push_back(u);
            }
        }
    }

    for (int i = 1; i < id; i++)
    {
        ;//cout << gg[i].first << " " << gg[i].second << " " << d[i] << endl;
    }

    ll ans = INF;
    for (int i = n; i <= n; i++)
    {
        for (auto it = col[i].begin(); it != col[i].end(); it++)
        {
            ans = min(ans, d[it->second]);
        }
    }
    if (ans == INF)
    {
        cout << -1;
        return 0;
    }
    cout << ans;
}


Measured memory_bytes: 191980
function Main (input){
  input = input.split("\n");
  tmp = input[0].split(" ");  
  var N = parseInt(tmp[0],10);
  var S = input[1];
  var answer = ""
  var alph = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
  for(var i=0; i<S.length; i++){
    x = S.charAt(i);
    var zurasi = (alph.indexOf(x) + N)%26;
    answer +=alph[zurasi];
  }
  console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11596
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int m,n;
    int sum=0;
    cin>>m>>n;
    int numbers[m];
    for(int i=0;i<m;i++)
    {
        cin>>numbers[i];
    }
    sort(numbers,numbers+m);
    for(int i=m-1;i>=m-n;i--)
    {
        sum+=numbers[i];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define pi pair<int,int> 
#define pii pair<pi,int>
#define ull unsigned long long
#define vi vector<int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
template <typename T>
void add(T &a, T b){
	a += b;
	if(a >= mod)a -= mod;
}
template <typename T>
void sub(T &a, T b){
	a -= b;
	if(a < 0)a += mod;
}
template <typename T>
void mul(T &a, T b){
	a *= b;
	if(a >= mod)a %= mod;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	vi h(n);
	rep(i,n){
		cin>>h[i];
	}
	ll ans = 0;
	map<ll,ll> sum;
	rep(i,n){
		ans += sum[(i+1)-h[i]];
		sum[h[i]+(i+1)]++;
	}	
	cout<<ans;
	return 0;
}

Measured memory_bytes: 26532
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  ll N;cin >> N;
  cout << N*(N-1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut a: Vec<usize> = Vec::with_capacity(n);
    let mut b: Vec<usize> = Vec::with_capacity(n);
    for _ in 0..n {
        a.push(read());
        b.push(read());
    }
    a.sort();
    b.sort();

    let mut ans = 0;
    if n % 2 == 0 {
        ans = b[n / 2] + b[n / 2 - 1] - (a[n / 2] + a[n / 2 - 1]);
    } else {
        ans = b[n / 2] - a[n / 2];
    }
    print!("{}", ans + 1);
}


Measured memory_bytes: 5736
#include <bits/stdc++.h>
 
using namespace std;
#define all(x) (x).begin(),(x).end()
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}
 
void solve() {
    int N, M;
    cin >> N >> M;
    vector<int> P(M), Y(M);
    vector<vector<int>> data(N + 1);
    for (int i = 0; i < M; i++) {
        cin >> P[i] >> Y[i];
        data[P[i]].push_back(Y[i]);
    }
 
    for (int i = 0; i < N + 1; i++) {
        sort(all(data[i]));
    }
 
    for (int i = 0; i < M; i++) {
        vector<int> &d = data[P[i]];
        int k = lower_bound(all(d), Y[i]) - d.begin();
        
        printf("%06d%06d\n", P[i], k + 1);
    }
 
}
 
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100000;
int main(){
	string in;
	cin >> in;
	int win = 0;
	for(char &i : in)win += (i == 'o');
	if(win + (15 - in.size())>= 8)cout << "YES\n";
	else cout << "NO\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
const int w=5e5+5;
const ll mod=998244353;
int n,m;
int main()
{
    int i,j;
    string a,b;
    cin>>a>>b;
    cout<<b+a<<endl;
    return 0;
}


Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []

for i in range(N):
    A.append(list(map(int, input().split())))

num = 0
for i in range(N):
  ans = 0
  for j in range(M):
    ans += A[i][j] * B[j]
  if ans + C > 0:
    num += 1
print(num)

    
    


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

int main(void){
    int A,B,total = 0;
    cin >> A >>B;
    
    for(int i = 0;i<2;i++){
        if(A<B){
            total += B;
            B -= 1;
        }else{
            total += A;
            A -= 1;
        }
    }
    cout<<total<<endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s== "Sunny" )
        cout<< "Cloudy"<<endl;
    else if(s== "Cloudy" )
        cout<< "Rainy"<<endl;
    else if(s== "Rainy" )
        cout<< "Sunny"<<endl;
    else
        cout<<"enter weather prediction"<<endl;


        return 0;
}




Measured memory_bytes: 256
/*input
123456789
*/

// Nihesh Anderson - knandy

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
ll MOD=1000000007;

#define endl '\n'
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
ll INF = 2000000000000000001;
long double EPS = 1e-9;
ll power(ll a, ll n, ll md){if(n==0){return 1;}else{ll res=power(a,n/2,md);res=(res*res)%md;if(n%2!=0){res=(res*a)%md;}return res;}}
random_device rndm;
mt19937 grndm(rndm());
void mix(ll* a, ll* b){shuffle(a,b,grndm);}

int main(){
	fast_cin();
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
	ll n; cin >> n;
	vector<char> ans;
	while(n) {
		n--;
		ans.push_back('a' + n % 26);
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	for(auto val: ans) {
		cout << val;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3640
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int k = sc.nextInt();
		int l = sc.nextInt();
		UnionFind uf1 = new UnionFind(n);
		for(int i = 0; i < k; i++){
		    int p = sc.nextInt()-1;
		    int q = sc.nextInt()-1;
		    uf1.union(p, q);
		}
		UnionFind uf2 = new UnionFind(n);
		for(int i = 0; i < l; i++){
		    int p = sc.nextInt()-1;
		    int q = sc.nextInt()-1;
		    uf2.union(p, q);
		}
		
		// 計算
		long result = 0;
		HashMap<Long, Integer> hm = new HashMap<Long, Integer>();
		Long[] keys = new Long[n];
		for(int i = 0; i < n; i++){
		    long key = uf1.find(i)*(long)n + uf2.find(i);
		    keys[i] = key;
		    hm.put(keys[i], hm.getOrDefault(keys[i], 0)+1);
		}
		
		// 出力
		for(int i = 0; i < n; i++){
		    System.out.print(hm.get(keys[i]));
		    System.out.print(" ");
		}
		//System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}

class UnionFind {
	int[] parent;
	int[] rank;
	int[] cnt;
	
	UnionFind(int n){
		this.parent = new int[n];
		this.rank = new int[n];
		this.cnt = new int[n];
		for(int i = 0; i < n; i++){
			parent[i] = i;
			rank[i] = 0;
			cnt[i] = 1;
		}
	}
	
	public int find(int i){
		if(i == parent[i]) return i;
		parent[i] = find(parent[i]);
		return parent[i];
	}
	
	public boolean union(int x, int y){
		int xRoot = find(x);
		int yRoot = find(y);
		if(xRoot == yRoot) return false;
		if(rank[xRoot] < rank[yRoot]){
			parent[xRoot] = yRoot;
			cnt[yRoot] += cnt[xRoot];
		}else if(rank[xRoot] > rank[yRoot]){
			parent[yRoot] = xRoot;
			cnt[xRoot] += cnt[yRoot];
		}else{
			parent[yRoot] = xRoot;
			rank[xRoot]++;
			cnt[xRoot] += cnt[yRoot];
		}
		return true;
	}
	
	public boolean same(int x, int y){
		return find(x) == find(y);
	}

	public int cnt(int x){
		return cnt[find(x)];
	}
}

Measured memory_bytes: 76276
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
D, X = get_ints

count = 0
N.times do |i|
  a = get_int

  i = 1
  x = 1
  while x <= D
    count += 1
    x = 1 + i * a
    i += 1
    # p x
  end
end

puts count + X


Measured memory_bytes: 14444
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 100005
const int INF = 1000000001;
const int MOD = 998244353 ; //1e9+7;

//vector< vector<ll> > g(N);
//vector< pair<ll, pair< ll, ll > > > g(N);
//ll vis[N] = {0}, par[N] = {0}, child[N] = {0}, cnt = 0;
ll n, dp[N][3] = {0};

void solve(){
    cin >> n;
    ll m[n][3];
    ll i, j;
    for(ll i=0; i<n; i++){
        for(ll j=0; j<3; j++) cin >> m[i][j];
    }
    dp[0][0] = m[0][0]; dp[0][1] = m[0][1]; dp[0][2]= m[0][2];
    ll pos = 0, mx = -INF;
    for(ll i=1 ; i<n; i++){
        dp[i][0] = m[i][0] + max( dp[i-1][1], dp[i-1][2] );
        dp[i][1] = m[i][1] + max( dp[i-1][0], dp[i-1][2] );
        dp[i][2] = m[i][2] + max( dp[i-1][1], dp[i-1][0] );
    }
    cout << max( {dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << "\n";
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //ll t;cin >> t;for(ll index=1; index<=t; index++){
        //cout << "Case #" << index << ": " ;
        solve();
   // }
    return 0;
}

Measured memory_bytes: 8304
n, W = map(int, input().split())
ab = [tuple(map(int, input().split()))for _ in range(n)]
ab.sort(reverse=True)

dp = [0]*W
for w, v in ab:
    for j in reversed(range(W)):
        if j-w < 0:
            break
        if dp[j] < dp[j-w]+v:
            dp[j] = dp[j-w]+v
    if dp[0] < v:
        dp[0] = v
print(max(dp))


Measured memory_bytes: 74648
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
ll inf=1e10;

int main(){
  ll N,A[300000];
  cin>>N;
  for (int i(0);i<3*N;i++) cin>>A[i];
  sort(A,A+3*N);
  ll ans(0);
  for (int i(0);i<N;i++){
    ans+=A[N+i*2];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560