akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;


int N, M;
int P[100000];

int root(int x){
    if(P[x] == x){
        return x;
    }
    return P[x] = root(P[x]);
}

void unite(int x, int y){
    P[root(x)] = root(y);
}

int main(){
    cin >> N >> M;
    for(int i = 0; i < N; i++){
        P[i] = i;
    }
    for(int i = 0; i < M; i++){
        int x, y, z;
        cin >> x >> y >> z;
        unite(x - 1, y - 1);
    }

    for(int i = 0; i < N; i++){
        root(i);
    }

    int ans = 0;
    for(int i = 0; i < N; i++){
        if(root(i) == i){
            ans++;
        }
    }
    cout << ans << endl;
}

    


Measured memory_bytes: 1152
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    let ans = match s.as_str() {
        "SUN" => 7,
        "MON" => 6,
        "TUE" => 5,
        "WED" => 4,
        "THU" => 3,
        "FRI" => 2,
        "SAT" => 1,
        _ => 0,
    };
    println!("{}", ans)
}


Measured memory_bytes: 4352
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
const int inf=1e18;
int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("in","r",stdin);
		freopen("out","w", stdout);
	#endif
	int n,m;
	cin>>n>>m;
	map<int,int> enemy;
	int a,b;
	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		if(enemy[a]>b or enemy[a]==0)enemy[a]=b;
	}
	int l,r=inf,ans=0;

	for(int l=1;l<=n;l++)
	{
		if(enemy[l]!=0)
		{
			r=min(enemy[l],r);
		}
		if(l>=r)
		{
			ans++;
			if(!enemy[l])r=inf;
			else r=enemy[l];
		}
	}
	cout<<ans;
}


Measured memory_bytes: 9832
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
template<class T> bool chmin(T &a, T b) {if(a>b){a=b;return 1;} return 0;}


int main() {
    int n;
    double t, a;
    int ans = 0;
    double mini = 1e9;
    cin >> n >> t >> a;
    
    rep(i,n) {
        double h;
        cin >> h;
        double tem = t-h*0.006;
        if (chmin(mini,abs(tem-a))) ans = i+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# import time
#
# start = time.time()

import sys
input = sys.stdin.readline
N,Q = [int(n) for n in input().split()]
S = "f" + input() + "f"
# print(S)
t = [""]*Q
d = [""]*Q
for i in range(Q):
    t[i],d[i] = [s for s in input().split()]

#左に落ちるやつで一番右のゴーレムのインデックスを探す
def leftbinarysearch():
    l = 0
    r = N + 1
    # cnt = 0#デバグ用カウンタ
    while(l<r):
        m = (l+r)//2 + 1#探索範囲の中央値のIndexのゴーレムでシミュレーション
        cur = m#探す一つのゴーレムの現在地
        fall = False
        # print(l,r,m)
        for i in range(Q):
            if t[i] == S[cur]:
                if d[i] == "L":
                    cur-=1
                else:
                    cur+=1
                if(cur == 0):#左端に落ちるなら次はもっと右のやつを確かめる
                    l = m
                    fall = True
                    break
                elif(cur == N+1):#右端に落ちるなら下の処理に飛ぶ
                    break
        if not fall:#落ちなかったならそれより左端を探す
            r = m - 1
        # cnt+=1
        # if(cnt == 10):print("loop", file=sys.stderr);break;
    return l

#→に落ちるやつを返す
def rightbinarysearch():
        l = 0
        r = N + 1
        # cnt = 0
        while(l<r):
            m = (l+r)//2#探索範囲の中央値のIndexのゴーレムでシミュレーション
            cur = m#探す一つのゴーレムの現在地
            fall = False
            # print(l,r,m)
            for i in range(Q):
                if t[i] == S[cur]:
                    if d[i] == "L":
                        cur-=1
                    else:
                        cur+=1
                    if(cur == N+1):#右端に落ちるなら次はもっと左のやつを確かめる
                        r = m
                        fall = True
                        break
                    elif(cur == -1):#左端に落ちるなら下の処理まで飛ぶ
                        break
            if not fall:#落ちなかったならそれより右端を探す
                l = m + 1
            # cnt+=1
            # if(cnt == 10):print("loop", file=sys.stderr);break;
        return l
# print(rightbinarysearch())
# print(leftbinarysearch())
print(rightbinarysearch()-leftbinarysearch()-1)

# end = time.time()
# print(end - start)


Measured memory_bytes: 6608
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int h, w;
	cin >> h >> w;
	string board[51];
	for (int i = 0; i < h; ++i) {
		cin >> board[i];
	}
	const int dx[8] = { 1,0,-1,0,1,-1,-1,1 };
	const int dy[8] = { 0,1,0,-1,1,1,-1,-1 };
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (board[i][j] == '#')continue;
			int num = 0;
			for (int d = 0; d < 8; ++d) {
				const int ni = i + dy[d];
				const int nj = j + dx[d];

				if (ni < 0 or h <= ni)continue;
				if (nj < 0 or w <= nj)continue;
				if (board[ni][nj] == '#')num++;
			}
			board[i][j] = char(num+'0');
		}
	}
	for (int i = 0; i < h; ++i) {
		cout << board[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
from heapq import heappop, heapify, heapreplace


X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

heapify(P)
heapify(Q)
heapify(R)

for _ in range(A - X):
    heappop(P)
for _ in range(B - Y):
    heappop(Q)


while R:
    p, q, r = P[0], Q[0], heappop(R)
    if p < q:
        T, t = P, p
    else:
        T, t = Q, q

    if t < r:
        heapreplace(T, r)

P.sort(reverse=True)
Q.sort(reverse=True)
ans = 0
for i in range(X):
    ans += P[i]
for i in range(Y):
    ans += Q[i]

print(ans)


Measured memory_bytes: 125608
#include "bits/stdc++.h"
using namespace std;
int p[100001], a[100001];
int find(int x)
{
	if(a[x] == x)
	{
		return x;
	}
	else
	{
		return a[x] = find(a[x]);
	}
}
bool issame(int x, int y)
{
	return find(x) == find(y);
}
void combine(int x, int y)
{
	x = find(x);
	y = find(y);
	if(x != y)
	{
		a[x] = y;
	}
}
int main()
{
	int n, m, total = 0;
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; ++i)
	{
		a[i] = i;
	}
	for(int i = 0, j; i < n; ++i)
	{
		scanf("%d", &j);
		p[j - 1] = i;
	}
	for(int i = 0, j, k; i < m; ++i)
	{
		scanf("%d%d", &j, &k);
		combine(j - 1, k - 1);
	}
	for(int i = 0; i < n; ++i)
	{
		total += issame(i, p[i]);
	}
	printf("%d\n", total);
}

Measured memory_bytes: 1024
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import core.bitop;

struct P {
  int honest;
  int unkind;
}

void main() {
  int n;
  readf (" %d", &n);
  auto h = new int[n];
  auto u = new int[n];
  foreach (i; 0 .. n) {
    int k;
    readf (" %d", &k);
    while (--k >= 0) {
      int x, y;
      readf (" %d %d", &x, &y);
      --x;
      if (y == 1) {
        h[i] |= 1 << x;
      } else {
        u[i] |= 1 << x;
      }
    }
  }
  int res;
  int all = (1 << n) - 1;
  foreach (i; 0 .. 1 << n) {
    bool ok = true;
    int ii = all ^ i;
    foreach (j; 0 .. n) {
      if ((1 << j) & i) {
        if ((h[j] & i) != h[j]) {
          ok = false;
          break;
        }
        if ((u[j] & ii) != u[j]) {
          ok = false;
          break;
        }
      }
    }
    if (ok) {
      debug stderr.writeln (i);
      res = max (res, popcnt (i));
    }
  }
  writeln (res);
}



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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int X; cin >> X;
	int ans = 0;
	while (ans * 1LL * (ans + 1) / 2 < X) ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

class mod_int{
private:
    unsigned long long num;
public:
    static constexpr auto mod=static_cast<unsigned long long>(1e9+7);
    static mod_int pow(mod_int x,unsigned long long y)
    {
        return y==0?1:y%2==0?pow(x*x,y/2):x*pow(x,y-1);
    }
    mod_int()=default;
    mod_int(unsigned long long n):num(n%mod)
    {
    }
    explicit operator unsigned long long()const
    {
        return num;
    }
    bool operator==(const mod_int&mi)const
    {
        return num==mi.num;
    }
    bool operator!=(const mod_int&mi)const
    {
        return !operator==(mi);
    }
    mod_int operator~()const
    {
        return pow(*this,mod-2);
    }
    mod_int operator+(const mod_int&mi)const
    {
        return num+mi.num;
    }
    mod_int operator-(const mod_int&mi)const
    {
        return num+mod-mi.num;
    }
    mod_int operator*(const mod_int&mi)const
    {
        return num*mi.num;
    }
    mod_int operator/(const mod_int&mi)const
    {
        return num*(~mi).num;
    }
    mod_int&operator+=(const mod_int&mi)
    {
        return*this=operator+(mi);
    }
    mod_int&operator-=(const mod_int&mi)
    {
        return*this=operator-(mi);
    }
    mod_int&operator*=(const mod_int&mi)
    {
        return*this=operator*(mi);
    }
    mod_int&operator/=(const mod_int&mi)
    {
        return*this=operator/(mi);
    }
};
int main()
{
    ll n=in(),k=in();
    mod_int ans=0;
    vector<mod_int>p(k+1);
    for(int g=k;g>=1;--g){
        p[g]=mod_int::pow(k/g,n);
        for(ll i=g*2;i<=k;i+=g)p[g]-=p[i];
        ans+=p[g]*g;
    }
    cout<<(unsigned long long)ans<<endl;
}


Measured memory_bytes: 4040
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		int n=sc.nextInt();
		long sum=0;
		for(int i=0; i<n; i++){
			sum+=sc.nextInt();
		}
		println(""+(sum/n));
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {


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

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<Integer> set = new TreeSet<>();

        for(int i=0; i<n; i++){
            set.add(sc.nextInt());
        }

        System.out.println(set.size());
    }

//    void dfs(int from, List<Integer> list, boolean[] reachedNodes){
////        System.out.println(eachCount);
//        int eachCount = 0;
//        for(boolean b: reachedNodes){
//            if(b){
//                eachCount++;
//            }
//        }
//        if(eachCount == N){
//            count++;
//            return;
//        }
////
//        for(int i: list){
//            if(reachedNodes[i]){
//                continue;
//            }
//            reachedNodes[i] = true;
////            System.out.println(String.format("%s %s", from+1, i+1));
//            dfs(i, map.get(i), reachedNodes);
//            reachedNodes[i] = false;
//        }
//    }

//    void dfs(int from, List<Integer> toList, boolean[] eachReachedNode, boolean[][] threwEdge, boolean countedFlug) {
//
//        reachedNode[from] = true;
//        eachReachedNode[from] = true;
//
//        for (int i : toList) {
//            if ((threwEdge[from][i] || threwEdge[i][from])) {
//                continue;
//            } else if(eachReachedNode[i] && !countedFlug){
////                System.out.println(String.format("%s %s", from , i));
//                count++;
//                countedFlug = true;
//                threwEdge[from][i] = true;
//                threwEdge[i][from] = true;
////                return;
//            } else {
//                if(map.get(i) == null){
//                    return;
//                } else {
//                    threwEdge[from][i] = true;
//                    threwEdge[i][from] = true;
//                    dfs(i, map.get(i), eachReachedNode, threwEdge, countedFlug);
//                }
//            }
//        }
//    }
//    void dfs(int from, int to) {
//
//        if (from > 100 || to > 100 || reachedArray[from][to]) {
//            return;
//        }
//
//        reachedArray[from][to] = true;
//
//        if (hasArray[from][to]) {
//            count++;
//        }
//        dfs(to, to + 1);
//        dfs(to + 1, to);
//    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int n;

vector<int> a(1010);

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

  rep(i,0,n - 1) rep(j,0,n - 1){
    if(i == j) continue;
    if(abs(a[i] - a[j]) % (n - 1) == 0){
      cout << a[i] << " " << a[j] << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


ll C2(ll n){
  return n*(n-1)/2;
}

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

 int n; cin >> n;
 vector<int> a(n), p(n);
 rep(i,0,n){ cin >> a[i]; a[i]--;}
 rep(i,0,n) p[a[i]]++;
 ll tot=0;
 rep(i,0,n){
   tot+=C2(p[i]);
 }
 rep(i,0,n) {
   ll ans=tot;
   ans-=C2(p[a[i]]);
   ans+=C2(p[a[i]]-1);
   cout << ans << endl;
 }

}

Measured memory_bytes: 4224
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define DEBUGM(d,n,m,i,j) printf("DEBUGM :\n"); rep(i,n){ rep(j,m) if(inf==d[i][j]) printf("inf "); else printf("%d ", d[i][j]); printf("\n");} printf("DEBUGM END LINE\n")

typedef vector<vector<pair<int,int> > > graph;
typedef long long ll;

const ll INF =1LL << 62;
const int inf =1 << 29;

int main(){
    int a=0,b=0,c=0;
    string s;
    cin >> s;
    rep(i,s.length()){
        switch(s[i]){
            case 'a':
            a++;
            break;
            case 'b':
            b++;
            break;
            case 'c':
            c++;
            break;
        }
    }
    if(a<b) swap(a,b);
    if(b<c) swap(b,c);
    if(a<b) swap(a,b);
    if((a - b == 1&& a - c == 1) || (a - c == 1 && b - c == 1) || (a==b && b==c)) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;

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

    int h, w;
    cin >> h >> w;

    queue<int> qy;
    queue<int> qx;
    vector<string> board(h);
    for (int i = 0; i < h; i++)
    {
        cin >> board[i];
        for (int j = 0; j < w; j++)
        {
            if (board[i][j] == '#')
            {
                qy.push(i);
                qx.push(j);
            }
        }
    }

    int cnt = qy.size();
    int ans = 0;
    bool end = true;
    while (qy.size() > 0)
    {
        int y = qy.front();
        int x = qx.front();
        qy.pop();
        qx.pop();
        cnt--;

        for (int i = 0; i < 4; i++)
        {
            int ty = y + dy[i];
            int tx = x + dx[i];
            if (0 <= ty && ty <= h - 1 && 0 <= tx && tx <= w - 1)
            {
                if (board[ty][tx] != '#')
                {
                    board[ty][tx] = '#';
                    qy.push(ty);
                    qx.push(tx);
                    end = false;
                }
            }
        }

        if (!end && cnt == 0)
        {
            cnt = qy.size();
            ans++;
            end = true;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9472
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{

    public class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            Console.WriteLine(isEasy(s) ? "Yes" : "No");
        }
        public static bool isEasy(string s)
        {
            for(int i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0 && s[i] == 'L' || i % 2 == 1 && s[i] == 'R')
                {
                    return false;
                }
            }
            return true;
        }
    }
}


Measured memory_bytes: 13140
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

use std::iter::Iterator;

fn main() {
    input! {
       a:usize,
       b:usize
    }

    println!("{}", (a - 1) * (b - 1));
}


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

// 二分搜索
bool BinarySearch(int A[], int n, int key) {
    int left = 0 , right = n, mid;

    while (left < right) {
        mid = (left + right) / 2;
        if (key == A[mid])
            return true;

        if(key > A[mid])
            left = mid + 1;
        if (key < A[mid])
            right = mid;
    }
    return false;

}
int main() {
    int n, q, key;
    int sum = 0;
    int A[100000 + 10];
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &A[i]);
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%d", &key);
        if (BinarySearch(A, n, key))
            sum++;
    }
    printf("%d\n", sum);
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
ll pow1(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a;
		}
		a=a*a;
		b=b>>1;
	}
	return ans;
}
ll mod = 1000000007;
// dp[i][j] means number of ways to get sum j using first i coins
// Storing as prefix sum
ll dp[105][100005];
int main()
{
	fast_io;
	ll n,k,i,j;
	cin>>n>>k;
	ll arr[n+1];
	for(i=1;i<=n;i++)
		cin>>arr[i];
	for(i=0;i<=arr[1];i++)
		dp[1][i] = 1;
	for(i=1;i<=k;i++)
		dp[1][i] += dp[1][i-1];
	for(i=2;i<=n;i++)
	{
		for(j=0;j<=arr[i];j++)
			dp[i][j] = dp[i-1][j];
		for(;j<=k;j++)
			dp[i][j] = (dp[i-1][j] - dp[i-1][j-arr[i]-1] + mod)%mod;
		for(j=1;j<=k;j++)
			dp[i][j] = (dp[i][j] + dp[i][j-1])%mod;
	}
	if(k == 0)
		cout<<dp[n][k]<<endl;
	else
		cout<<(dp[n][k] - dp[n][k-1] + mod)%mod<<endl;
	return 0;
}

Measured memory_bytes: 79360
import std.stdio;

int f_debt(int n)
{
	n *= 1.05;
	if(n % 1000 != 0)
	{
		n = n - (n%1000) + 1000;
	}
	return n;
}


int main()
{
	int i,debt=100000;
	readf("%d",&i);
	foreach(int j;0..i)
	{
		debt = f_debt(debt);
	}
	writeln(debt);
	return 0;
}

Measured memory_bytes: 1064
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        
        if(a < b){
            System.out.println("a < b");
        } else if (a > b){
            System.out.println("a > b");
        } else if(a == b){
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26192
#include <iostream>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
 
int count = 0;
 
void Merge(int A[], int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1+1], R[n2+1];
  rep(i,n1) L[i] = A[left+i];
  rep(i,n2) R[i] = A[mid+i];
  L[n1] = R[n2] = 0x7FFFFFFF;
  i = j = 0;
  for (k = left; k < right; k++) {
    count++;
    if (L[i] < R[j]) { A[k] = L[i]; i++; }
    else { A[k] = R[j]; j++; }
  }
}
 
void MergeSort(int A[], int left, int right) {
  if (left+1 < right) {
    int mid = (left + right) / 2;
    MergeSort(A, left, mid);
    MergeSort(A, mid, right);
    Merge(A, left, mid, right);
  }
} 
 
int main () {
  cin.tie(0); // tie
  ios::sync_with_stdio(false); // sync
  int n, i;
 
  // input
  cin >> n;
  int A[n];
  rep(i,n) cin >> A[i];
  MergeSort(A, 0, n);
 
  // output
  rep(i,n) {
    cout << A[i];
    if (i < n-1) cout << " ";
  }
  cout << endl << count << endl;
  return 0;
}

Measured memory_bytes: 7008
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000

struct Card{
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int n, int left, int mid, int right){
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;

  for(i = 0; i < n1; i++){
    L[i] = A[left + i];
  }
  for(i = 0; i < n2; i++){
    R[i] = A[mid + i];
  }
  L[n1].value = R[n2].value = SENTINEL;

  i = j = 0;

  for(k = left; k < right; k++){
    if(L[i].value <= R[j].value){
      A[k] = L[i++];
    }
    else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right){
  int mid;

  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int partition(struct Card A[], int n, int p, int r){
  int i, j;

  struct Card t, x;
  x = A[r];
  i = p - 1;

  for(j = p; j < r; j++){
    if(A[j].value <= x.value){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i + 1];
  A[i + 1] = A[r];
  A[r] = t;
  return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r){
  int q;

  if(p < r){
    q = partition(A, n, p, r);
    quickSort(A, n, p, q - 1);
    quickSort(A, n, q + 1, r);
  }
}

int main(){
  int n, i, v;
  int stable = 1;
  char S[10];
  struct Card A[MAX], B[MAX];

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%s %d", S, &v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A, n, 0, n);
  quickSort(B, n, 0, n-1);

  for(i = 0; i < n; i++){
    if(A[i].suit != B[i].suit) stable = 0;
  }

  if(stable == 1) printf("Stable\n");
  else printf("Not stable\n");

  for(i = 0; i < n; i++){
    printf("%c %d\n", B[i].suit, B[i].value);
  }

  return 0;
}
	



Measured memory_bytes: 4068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(a) cout << #a << ": " << a << endl
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define fast cin.tie(0); ios::sync_with_stdio(false)
#define int long long
int32_t main(){
	string s; cin>>s;
	s[3] = '8';
	cout<<s<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
using namespace std;

#define endl '\n'
#define int long long
const int MAXN = 1e5+5;
const int MOD = 1e9+7;
int n, u, v;
vector<int> adj[MAXN];
int visited[MAXN];
int dp[MAXN][2];
int ans = 0;

void dfs(int i)
{
    visited[i] = 1;
    for (auto j: adj[i])
    {
        if (!visited[j])
        {
            dfs(j);
            dp[i][0] *= (dp[j][0] + dp[j][1]);
            dp[i][0] %= MOD;
            dp[i][1] *= (dp[j][0]);
            dp[i][1] %= MOD;
        }
    }
}
signed main()
{
    memset(visited,0,sizeof visited);
    cin >> n;

    for (int i = 1; i < n; i++)
    {
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for (int i = 1; i <= n; i++)
    dp[i][0] = dp[i][1] = 1;
    dfs(1);

    cout << (dp[1][0] + dp[1][1])%MOD;
}
/*
10
8 5
10 8
6 5
1 5
4 8
2 10
3 6
9 2
1 7
*/
/*
4
1 2
1 3
3 4
*/


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

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

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

  string s;
  cin >> s;
  ll n = s.size();

  if(s.substr(0, 7) == "keyence" || s.substr(s.size()-7, 7) == "keyence") {
    cout << "YES" << endl;
    return 0;
  }

  REP(i, n) FOR(j, i, n) {
    string t = "";
    REP(k, i) {
      t += s[k];
    } 
    FOR(k, j+1, n) {
      t += s[k];
    }
    if(t == "keyence") {
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
//26

signed main(){
	int n, cnt = 0, ans = INF;
	string str;
	scanf("%lld", &n);
	cin >> str;
	rep(i,n)if(str[i] == 'E')cnt++;
	rep(i,n){
		if(str[i] == 'E')cnt--;
		chmin(ans, cnt);
		if(str[i] == 'W')cnt++;
	}
	printf("%lld\n", ans);
	return 0;
}




Measured memory_bytes: 900
#include <cstdio>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int N; char t[12]; long long ans;
string ts; map<string, int> s;
int main() {
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%s", t); ts = string(t);
    sort(ts.begin(), ts.end());
    s[ts]++;
  }
  for(auto x : s) {
    for(int i = 0; i < x.second; i++) {
      for(int j = i+1; j < x.second; j++) ans++;
    }
  }
  printf("%ld", ans);
}

Measured memory_bytes: 11136
s= input()
t = input()

count = len(t)

for i in range(len(s) - len(t) + 1):
    str_ = s[i:i + len(t)]
    temp = 0
    for i in range(len(str_)):
        #print(str_[i])
        if str_[i] != t[i]:
            temp += 1
    count = min(count, temp)    
        
print(count)

Measured memory_bytes: 9084
#include <cassert>
#include <cmath>
#include <iostream>
#include <iomanip>

int main()
{
    while(true){
        int a, b;
        char c;
        std::cin >> a >> c >> b;
        if(c == '?') break;
        switch(c){
            case '+':
                std::cout << a + b << std::endl;
                break;
            case '-':
                std::cout << a - b << std::endl;
                break;
            case '*':
                std::cout << a * b << std::endl;
                break;
            case '/':
                std::cout << a / b << std::endl;
                break;
            default: assert(false);
        }
    }
    return 0;
}

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

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

inline int Pow(int a, int k) {
  int s = 1; 
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

// Init variables here
const int N = 1e6 + 7;

void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
}

void preprocess() {
}

void debug() {
  //  44gg
  if (true) {
  
  }
}


void solve() {
  preprocess();
  // 50gg
  string s;
  cin >> s;
  int n = s.length();
  char x = '0', y = '1';
  int a = 0, b = 0;
  FOR(i, 0, n) {
    if (s[i] != x) {a++;}
    if (s[i] != y) {b++;}
    swap(x, y);
  }
  cout << min(a, b) << endl; 
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

void output() {

}

#undef int
int main() {
#define int long long
	ios_base::sync_with_stdio(false);
	cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  //int t; cin >> t;
  //while (t--) 
  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int MXN = 1e5 + 5;
int n, m;
int dp[MXN];
vector<int> g[MXN];

int dfs(int u) {
    if(dp[u] != -1) return dp[u];
    int ans = 0;
    for(auto & v: g[u]) {
        ans = max(ans, dfs(v) + 1);
    }
    return dp[u] = ans;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        u--, v--;
        g[u].emplace_back(v);
    }
    memset(dp, -1, sizeof dp);
    int ans = 0;
    for(int i = 0; i < n; i++) {
        ans = max(ans, dfs(i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11560
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import java.util.*;

public class Main {
	static int N;
	static int[] a;
    static ArrayList<ArrayList<Integer>> edge;
    static ArrayList<ArrayList<Integer>> children;
    static int[] parent;
    static boolean[] visited;
    static int[] dp;

    static void dfs(int x, Integer[] arr) {
        if (visited[x]) return;
        visited[x] = true;
        int index = ~Arrays.binarySearch(arr, a[x], (o1, o2) -> o1>=o2 ? 1 : -1);
        int before_a_x = arr[index];
        arr[index] = a[x];
        dp[x] = ~Arrays.binarySearch(arr, 999_999_999, (o1, o2)-> o1>=o2 ? 1 : -1);

        for (Integer i : edge.get(x)) {
            if (!visited[i]) {
                children.get(x).add(i);
                parent[i] = x;
                dfs(i, arr);
            }
        }

        arr[index] = before_a_x;
    }

	public static void main(String[] args) {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
		N = in.nextInt();
		a = new int[N];
        edge = new ArrayList<ArrayList<Integer>>();
        children = new ArrayList<ArrayList<Integer>>();
        parent = new int[N];
        parent[0] = -1;
        dp = new int[N];
		for (int i=0;i<N;i++) {
			a[i] = in.nextInt();
		}
        for (int i=0;i<N;i++) {
            ArrayList<Integer> add_1 = new ArrayList<Integer>();
            ArrayList<Integer> add_2 = new ArrayList<Integer>();
            edge.add(add_1);
            children.add(add_2);
        }

		for (int i=0;i<N-1;i++) {
			int u = in.nextInt()-1;
			int v = in.nextInt()-1;
            edge.get(u).add(v);
            edge.get(v).add(u);
		}

        visited = new boolean[N];
        int INF = 1_000_000_000;
        Integer[] arr = new Integer[N];
        Arrays.fill(arr, INF);
        dfs(0, arr);
        for (int i=0;i<N;i++) {
        	out.println(dp[i]);
        }

		out.close();
	}

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

    }
}


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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(void){
    int n;
    cin >> n;
    vector<lli> a(n+1);
    vector<lli> b(n);
    for(auto& i : a) cin >> i;
    for(auto& i : b) cin >> i;
    lli c = 0;
    for(int i = 0; i < n; i++){
        if(a.at(i) >= b.at(i)){
            c+=b.at(i);
            a.at(i)-=b.at(i);
            b.at(i) = 0;
        }else{
            c+=a.at(i);
            b.at(i) -= a.at(i);
            a.at(i) = 0;
            if(a.at(i+1) >= b.at(i)){
                c+=b.at(i);
                a.at(i+1)-=b.at(i);
            }else{
                c+=a.at(i+1);
                b.at(i)-=a.at(i+1);
                a.at(i+1) = 0;
            }
        }
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 1792
def binary_search_int(ok, ng, test, p):
    """
    :param ok: solve(x) = True を必ず満たす点
    :param ng: solve(x) = False を必ず満たす点
    """
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if test(mid, p):
            ok = mid
        else:
            ng = mid
    return ok

def lcm(x,y):
    return x*y//gcd(x,y)

from math import gcd

A, B, C, D = map(int, input().split())
l = lcm(C,D)

def test1(x, p):
    return x*p<=B
b = [binary_search_int(0,10**18+1,test1, x) for x in [C, D, l]]

def test2(x, p):
    return x*p>=A

a = [binary_search_int(10**18+1, 0,test2, x) for x in [C, D, l]]

res = [x-y+1 if (x!=0 and y!=10**18+1) else 0 for x, y in zip(b, a)]


print((B-A+1)-res[0]-res[1]+res[2])

Measured memory_bytes: 61760
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<ll,ll> pint;

vector<pint> vp[100001];
ll ans;
ll h[100001];
ll INF=1000100010001000100;
int n;
ll x;
bool used[100001];
ll dijkstra(int st){
    priority_queue<pint> pq;
    pq.push(make_pair(x,st));
    while(!pq.empty()){
        pint pi=pq.top();pq.pop();
        ll t=pi.second;
        if(used[t]) continue;
        used[t]=true;
        if(t==n-1) return ans=pi.first;
        for(vector<pint>::iterator it=vp[t].begin();it!=vp[t].end();++it){
            pq.push(make_pair(min(h[it->second],pi.first-it->first),it->second));
        }
    }
    return ans=-INF;
}
int main(){
    int m,sr,ds,dt;
    cin>>n>>m>>x;
    rep(i,n) cin>>h[i];
    rep(i,m){
        cin>>sr>>ds>>dt;
        --sr,--ds;
        if(h[sr]>=dt) vp[sr].pb(dt,ds);
        if(h[ds]>=dt) vp[ds].pb(dt,sr);
    }
    dijkstra(0);
    if(ans!=-INF)cout<<x-ans*2+h[n-1]<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 29824
#include <stdio.h>

void rect(int, int);

int main(void) {
    int h, w;
    while(scanf("%d %d", &h, &w), h || w) {
        rect(h, w), printf("\n");
    }
    return 0;
}

void rect(int h, int w) {
    int i, j;
    for(i = 0; i++ < h; printf("\n")) {
        for(j = 0; j++ < w; printf("#"));
    }
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+1;
const int mod = 1e9+7;
int etf[upperlimit];
int nfac[upperlimit];
int main() {
	for(int i = 1; i < upperlimit; i++) etf[i]=i;
	for(int i = 2; i < upperlimit; i++){
		if(etf[i]<i) continue;
		for(int j = i; j < upperlimit; j+=i){
			etf[j]/=i;
			etf[j]*=i-1;
		}
	}
	int n,k;
	sd(k);sd(n);
	for(int i = 1; i <= n; i++) nfac[i]=n/i;
	ll ans=0;
	for(int i = 1; i <= n; i++){
		ll temp=powmod(nfac[i],k,mod);temp*=etf[i];temp%=mod;
		ans+=temp;ans%=mod;
	}
	plld(ans);
	return 0;
}

Measured memory_bytes: 8132
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		String inputStr1 = scan.next();
		String inputStr2 = scan.next();

		scan.close();

		System.out.println(inputStr2 + inputStr1);
	}

}


Measured memory_bytes: 21204
#include <stdio.h>

struct Card
{
  char suit;
  int value;
};

void bubble(struct Card b[], int n)
{
  int i, j;
  struct Card swap;
  
  for(i = 1; i < n; i ++ ){
    for(j = n-1; j >= i; j--){
      if(b[j].value < b[j-1].value){
       swap = b[j];
       b[j] = b[j-1];
       b[j-1] = swap;
      }
    }
  }
}

void selection(struct Card s[], int n)
{
  int min, i, j;
  struct Card swap;
  
  for(i = 0; i < n; i++){
    min = i;
    for(j = i; j < n; j++){
      if(s[j].value < s[min].value)
        min = j;
    }
    if( i != min){
      swap = s[i];
      s[i] = s[min];
      s[min] = swap;
    }
  }
}

int stable(struct Card b[], struct Card s[], int n)
{
  int i;
  
  for(i = 0; i < n; i++){
    if(b[i].suit != s[i].suit)
      return 0;
  }
  
  return 1;
}

int main()
{
  struct Card b[36], s[36];
  char space;
  int i, n;
  
  scanf("%d\n", &n);
  
  for(i = 0; i < n; i++){
    scanf("%c%d", &b[i].suit, &b[i].value);
    scanf("%c", &space);
  }
  
  for(i = 0; i < n; i++)
    s[i] = b[i];
    
  bubble(b, n);
  
  selection(s, n);
  
  for(i = 0; i < n-1; i++)
    printf("%c%d ", b[i].suit, b[i].value);
    
  printf("%c%d\n", b[n-1].suit, b[n-1].value);
  
  puts("Stable");
  
  for(i = 0; i < n-1; i++)
    printf("%c%d ", s[i].suit, s[i].value);
    
  printf("%c%d\n", s[n-1].suit, s[n-1].value);
  
  if(stable(b, s, n))
    puts("Stable");
  else
    puts("Not stable");
    
  return 0;
}

Measured memory_bytes: 1852
#include<stdio.h>
int main(){
int a,b,c,i;
scanf("%d\n",&a);
for(i=0;i<a;i++){
scanf("%d %d\n",&b,&c);
if(b%c==0){
printf("%d\n",c);
}
else{
printf("%d\n",b%c);
}
}
return 0;
}



Measured memory_bytes: 1992
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

const int MAX_V = 301;
LL d[MAX_V][MAX_V];//d[i][j]はe={u,v}のコスト(存在しないときはINF,i==jのときは0)
int n;

void warshall_floyd() {
	for (int k = 0; k<n; k++) {
		for (int i = 0; i<n; i++) {
			for (int j = 0; j<n; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}
int a[301][301];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> d[i][j];
			a[i][j] = d[i][j];
		}
	}
	warshall_floyd();
	for (int i = 0; i < n; i++) {
		for (int j =0 ; j < n; j++) {
			if (d[i][j] != a[i][j]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	LL ans = 0;
	for(int i=0;i<n;i++){
		for (int j = i + 1; j<n; j++) {
			bool flag = true;
			for(int k=0;k<n;k++){
				if (a[i][j] == a[i][k] + a[k][j] && k != i&&k != j)flag = false;
			}
			if (flag)ans += a[i][j];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<30;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int N, M;
bool ok[9];
int dat[9] = {2,5,5,4,5,6,3,7,6};

string dp[11234];

int compare(string &a, string &b) {
	if (a.size() > b.size()) return 1;
	if (a.size() < b.size()) return -1;
	if (a > b) return 1;
	if (a < b) return -1;
	return 0;
}

int main() {
	cin >> N >> M;
	REP(i, M) {
		int A;
		scanf("%d", &A);
		ok[A - 1] = true;
	}
	
	fill(dp, dp + 11234, "0");
	REP(i, 11200) {
		if (i != 0 && dp[i] == "0") continue;
		REP(j, 9) if (ok[j]) {
			string cur = dp[i];
			if (cur == "0") cur = '1' + j;
			else cur += '1' + j;
			
			if (compare(dp[i + dat[j]], cur) == -1) dp[i + dat[j]] = cur;
		}
	}
	
	cout << dp[N] << endl;
	
	return 0;
}


Measured memory_bytes: 55296
#include<iostream>
#include<math.h>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || b + c == a || c + a == b) {
		cout << "Yes" << endl;

	}
	else {
		cout << "No" << endl;

	}

}

Measured memory_bytes: 256