akhauriyash/Code-Regression huggingface dataset:
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID
#include<string>
#include<bits/stdc++.h>


#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define print(v) for(auto it=(v).begin();it!=(v).end();it++) {cout<<*it<<" ";}
#define ll long long
#define w(t) ll t;cin>>t;while(t--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
using namespace std;


int main()
{
    int n,k,ans=0;
  cin>>n>>k;
  while(n--)
  {
    int h;
    cin>>h;
    ans+=(h>=k);
  }
  cout<<ans<<"\n";
    return 0;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int mincost(int a[],int n){
  int i;
    int dp[n+1];
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(a[1]-a[0]);
    for(i=2;i<n;i++){
        dp[i+1]=min(abs(a[i]-a[i-1])+dp[i],abs(a[i]-a[i-2])+dp[i-1]);
    }
    return dp[n];
}
int main(){
    int n,i,d;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    d=mincost(a,n);
    cout<<d;
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

int main() {
  int n;
  cin >> n;
  VEC<string> w(n);
  REP(i, 0, n) cin >> w[i];
  bool valid = true;
  map<string, int> d;
  REP(i, 0, n - 1) {
    d[w[i]]++;
    char last = w[i][w[i].length() - 1];
    char first = w[i + 1][0];
    DUMP(w[i], last, first);
    if (last != first||d[w[i]]>1) {
      valid = 0;
      break;
    }
  }
    d[w[n-1]]++;
  
  Yes(valid&&d[w[n-1]]<=1);

  return 0;
}


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

int main() {
  int n;
  cin>>n;
  while(n--) {
    string s1,s2;
    cin >> s1 >> s2;

    int a = s1.length()-1;
    int b = s2.length()-1;
    int c = 0;
    vector<int> ans;
    for (; a>=0 || b>=0; a--, b--) {
      int s = c;
      if (a>=0) s+=s1[a]-'0';
      if (b>=0) s+=s2[b]-'0';
      c = s / 10;
      ans.push_back(s % 10);
    }
    if (c) ans.push_back(1);
    reverse(ans.begin(), ans.end());
    if (ans.size()<=80)
      for (int i=0; i<ans.size(); i++)
        cout << ans[i];
    else
      cout << "overflow";
    cout << endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,tot;
queue<ll>q;
int main()
{
	scanf("%lld",&n);
	for(ll i=1;i<=9;i++)q.push(i);
	while(!q.empty())
	{
		ll tx=q.front(); q.pop();
		if(++tot==n)
		{
			printf("%lld\n",tx);
			exit(0);
		}
		if(tx%10>0)q.push(tx*10+tx%10-1);
		q.push(tx*10+tx%10);
		if(tx%10<9)q.push(tx*10+tx%10+1);
	}
	return 0;
}

Measured memory_bytes: 5316
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n';

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> dp_a(n + 1, -MOD), dp_b(n + 1, -MOD), dp_c(n + 1, -MOD);
	cin >> dp_a[0] >> dp_b[0] >> dp_c[0];
	rep2(i, 1, n) {
		int a, b, c;
		cin >> a >> b >> c;
		dp_a[i] = max(dp_b[i-1], dp_c[i-1]) + a;
		dp_b[i] = max(dp_a[i-1], dp_c[i-1]) + b;
		dp_c[i] = max(dp_a[i - 1], dp_b[i - 1]) + c;
	}
	cout << max(max(dp_a[n - 1], dp_b[n - 1]), dp_c[n - 1]);
}



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

int main() {
  int d, n;
  cin >> d >> n;
  int hundred = 1;
  for (int k = 0; k < d; k++) {
    hundred *= 100;
  }

  int ans = hundred * n;
  cout << (n != 100 ? ans : ans + hundred) << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  long a = sc.nextLong();
	  long b = sc.nextLong();
	  long c = sc.nextLong();
	  long d = sc.nextLong();
	  
	  long lcm = (c*d)/ gcd(d, c);
	  
	  long res = (b - (b/c + b/d - b/lcm)) - ((a-1) - ((a-1)/c + (a-1)/d - (a-1)/lcm));
	  
	  System.out.println(res);
  }
 
  private static long gcd(long m, long n) {
	  if (m < n) {
		  return gcd(n, m);
	  }
	  
	  if (n == 0) {
		  return m;
	  }
	  
	  return gcd(n, m % n);
  }
 
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


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

using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;

	if (A + B >= C) {
		cout << "Yes";
	}
	else{
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
ans = 0
for i in range(N-1):  # 切り取る場所
    n = 0
    right = S[i+1:]
    for c in list(set(S[:i+1])):
        if c in right:
            n += 1
    ans = max(ans, n)


print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
int main()
{
    int i = 0;
    int num,max = 0;
    int no[100] = {0};
    
    while(scanf("%d",&num) == 1){
        if(i >= 100){
            break;
        }
        no[num] += 1;
        if(max < no[num]){
            max = no[num];
        }
        i++;
    }
    for(i = 0;i < 100;i++){
        if(no[i] == max){
            printf("%d\n",i);
        }
    }
    return 0;
}

Measured memory_bytes: 596
use std::io::Read;
use std::collections::VecDeque;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: isize = iterator.next().unwrap().parse().unwrap();
    let q: i32 = iterator.next().unwrap().parse().unwrap();

    let mut queue: VecDeque<Process> = VecDeque::new();
    for _i in 0..n {
        queue.push_back(
            Process {
                name: iterator.next().unwrap().to_string(),
                quantum: iterator.next().unwrap().parse().unwrap(),
            }
        );
    }

    let mut output = String::new();

    let mut time: i32 = 0;
    while !queue.is_empty() {
        let mut p = queue.pop_front().unwrap();

        if p.quantum <= q {
            time += p.quantum;
            output += &format!("{} {}\n", p.name, time);
        } else {
            p.quantum -= q;
            time += q;
            queue.push_back(p);
        }
    }

    return output.trim().to_string();
}

#[derive(Debug)]
struct Process {
    name: String,
    quantum: i32,
}



Measured memory_bytes: 9020
package main
import(
  "fmt"
  "sort"
)
func main(){
  var n, k, i int
  ans:=0
  fmt.Scan(&n, &k)
  a:=make([]int, n)
  for i=0;i<n;i++{
    fmt.Scan(&a[i])
  }
  sort.Sort(sort.IntSlice(a))
  for i=0;i<k;i++{
    ans+=a[i]
  }
  fmt.Println(ans)
}


Measured memory_bytes: 1888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n;
    cin >> n;
    cout << n * n * n << "\n";
}

Measured memory_bytes: 256
using System;

namespace AtCoder2020Ned
{
    class Program
    {
        static void Main(string[] args)
        {
            // 従業員の数
            var numberOfEmployee = int.Parse(Console.ReadLine());

            // 従業員から見た上司の社員番号
            var myBoss = Console.ReadLine().Split(" ");

            // 上司から見た部下の数
            var personalStaff = new int[numberOfEmployee];

            for (int i = 0; i < myBoss.Length; i++)
            {
                personalStaff[int.Parse(myBoss[i]) - 1]++;
            }

            foreach (var item in personalStaff)
            {
                Console.WriteLine(item);
            }

            Console.Read();
        }
    }
}


Measured memory_bytes: 41832
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD =   1000000007;

int main()
{
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    string s; cin >> s;
    char tmp = s[0];
    bool flag = true;
    for(int i = 1; i < 4; ++i){
        if(tmp == s[i]){
            flag = false;
            break;
        }
        tmp = s[i];
    }

    if(flag){
        cout << "Good" << endl;
    }
    else{
         cout << "Bad" << endl;
    }

    return 0;
}


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

#define fr(i, n)    for(int i=0; i<(int)n; ++i)
#define rfr(i, n)   for(int i=(int)n-1; i>=0; --i)
#define foor(i,a,n) for(int i=a; i<=(int)n; ++i)
#define rfoor(i,n,a)for(int i=(int)n; i>=a; --i)
#define foru(it, v) for(auto it : v)
#define si(n)       scanf("%d", &n)
#define si2(n,m)    scanf("%d%d", &n, &m)
#define si3(n,m,l)  scanf("%d%d%d", &n, &m, &l)
#define sl(n)       scanf("%lld", &n)
#define sl2(n,m)    scanf("%lld%lld", &n, &m)
#define sl3(n,m,l)  scanf("%lld%lld%lld", &n, &m, &l)
#define sd(n)       scanf("%lf", &n)
#define sld(n)      scanf("%Lf", &n)
#define sc(n)       scanf(" %c", &n)
#define sstr(n)     scanf("%s", n)
#define pi(n)       printf("%d\n", n)
#define pis(n)      printf("%d ", n)
#define pi2(n,m)    printf("%d %d\n", n, m)
#define pi3(n,m,l)  printf("%d %d %d\n", n, m, l)
#define pl(n)       printf("%lld\n", n)
#define pls(n)      printf("%lld ", n)
#define pl2(n,m)    printf("%lld %lld\n", n, m)
#define pl3(n,m,l)  printf("%lld %lld %lld\n", n, m, l)
#define pc(n)       printf("%c", n)
#define pstr(n)     printf("%s\n", n)
#define pstr2(n, m) printf("%s %s\n", n, m)
#define ff          first
#define ss          second
#define all(v)      v.begin(), v.end()
#define rall(v)     v.rbegin(), v.rend()
#define sz(v)       (int)v.size()
#define pub         push_back
#define pob         pop_back()
#define mmst(a, n)  memset(a, n, sizeof a);
#define ppcnt(n)    __builtin_popcountll(n);
#define leadingZ(n) __builtin_clz(n)
#define trailingZ(n)__builtin_ctz(n)
#define OO          0x3f3f3f3f
#define OOLL        0x3f3f3f3f3f3f3f3f
#define MOD         1000000007
#define EPS         0.000000001
#define ndl         "\n"
#define fastin      ios::sync_with_stdio(false); cin.tie(nullptr);
#define infile      freopen("input.txt", "r", stdin);
#define outfile     freopen("output.txt", "w", stdout);
#define PNO         printf("NO\n")
#define PYES        printf("YES\n")
#define pno         printf("No\n")
#define pyes        printf("Yes\n")
#define pln         printf("\n")

//#define row         vector<long long>
//#define matrix      vector<row>
//#define ROWS(v)     (v).size()
//#define COLS(v)     (v)[0].size()

#define DBG1(x)     cerr<<#x<<":"<<(x)<<'\n';
#define DBG2(x, y)  cerr<<#x<<":"<<(x)<<"  "<<#y<<":"<<(y)<<'\n';
#define DBG3(x,y,z) cerr<<#x<<":"<<(x)<<"  "<<#y<<":"<<(y)<<"  "<<#z<<":"<<(z)<<'\n';

using namespace std;

typedef long long lld;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vii;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<long long , long long>> vpll;
typedef complex<double> point;

const int N = 1e5 + 9;

int t, id, n, m, x, y, k, c, xx, yy, ans;
//int a[N], f[N], cu[N], b[N];
vii v, adj[N];
bool fl, ok;
lld res, tot, sum;
char ch;
string s, z;
//char s[3][N], z[N];

int main()
{
    //infile;
    //outfile;
    //fastin;
    si(n);
    pl((lld)n*(n-1)/2);
    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
    char s[100];
    scanf("%s",s);
    int n=strlen(s);
    if(n%2==0){
        printf("No\n");
        return 0;
    }
    int m=(n-1)/2;
    int count=0;
    for(int i=0;i<n;i++){
        if(s[i]==s[n-i-1])
            count++;
    }
    if(count!=n){
        printf("No\n");
        return 0;
    }
    count=0;
    for(int i=0;i<m;i++){
        if(s[i]==s[m-i-1])
            count++;
    }
    if(count!=m){
        printf("No\n");
        return 0;
    }
    char t[101];
    for(int i=m+1;i<n;i++)
        t[i-m-1]=s[i];
    t[n-m-1]=0;
    int str=n-m-1;
    count=0;
    for(int i=0;i<str;i++){
        if(t[i]==t[str-i-1])
            count++;
    }
    if(count==str)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
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); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)


int n;
int h[101010];
int dp[101010];


int main(){
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> h[i];
    }
    for(int i = 1;i <= n;i++){
        dp[i] = INF<int>();
    }
    dp[1] = 0;
    for(int i = 2;i <= n;i++){
        if(i >= 2)dp[i] = min(dp[i], dp[i - 1] + abs(h[i - 1] - h[i]));
        if(i >= 3)dp[i] = min(dp[i], dp[i - 2] + abs(h[i - 2] - h[i]));
    }
    cout << dp[n] << endl;
}

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

int main() {
  int n;
  cin >> n;
  char x;
  string ans = "Three";
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x == 'Y') {
      ans = "Four";
      break;
    }
  }
  cout << ans << endl;
}

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

int N,M,X;
int A[102] = {0};
int main(){
	cin >> N >> M >> X;
	for(int i=0;i<M;i++){
		int a;
		cin >> a;
		A[a] = 1;
	}
	int ans = 1e9;
	int n = 0;
	for(int i=X+1;i<N;i++){
		n += A[i];
	}
	ans = min(ans,n);
	n = 0;
	for(int i=0;i<X;i++){
		n += A[i];
	}
	cout << min(ans,n) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
    
int main(){
    int n,k;
    cin >> n >> k;
    vector <long long> a(n);
    rep(i,n) cin >> a[i];
    int left = 0;
    int right = k;
    for(int i=k; i<n; i++){
        if(a[left] < a[right]){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
        left++;
        right++;
    }
}

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

int main(){
    int n,ans;
    cin>>n;
    ans=0;

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(4*i+7*j==n){
                ans=1;
                break;
            }
        }
        if(ans==1)break;
    }

    if(ans==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	string a, b;
	cin >> a >> b;
	cout << b + a << "\n";

	return 0;
}



Measured memory_bytes: 256
import math
c = 0

n = int(input())
*A, = map(int, input().split())

def marge(A, right, mid, left):
    global c
    L, R = A[right:mid], A[mid:left]
    R.append(int(10E10))
    L.append(int(10E10))
    i, j = 0, 0
    smin = int(10E10)
    nums = 0
    for k in range(right, left):
        if L[i] <= R[j]:
            if smin < L[i]:
                c = c + (len(L) - i - 1) * nums
                # for cnt in range(i, len(L) - 1):
                #     print(L[cnt], smin)
                smin,nums = int(10E10), 0
            A[k] = L[i]
            i = i + 1
        else:
            A[k] = R[j]
            smin, nums = R[j], nums + 1
            j = j + 1

def marge_sort(A, right, left):
    if right + 1 < left:
        mid = math.ceil((left + right) / 2)
        marge_sort(A, right, mid)
        marge_sort(A, mid, left)
        marge(A, right, mid, left)

marge_sort(A, 0, n)
print(c)




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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, l, r, ans;

int main() {
	cin >> n;
	inc(i, n) { cin >> l >> r; ans += (r - l + 1); }
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : AOJCpp.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main() {


	int n;
	int inputs[MAX];

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

	int maxv = -2000000000;
	int minv = inputs[0];
	for(int i = 1; i < n; i++) {

		maxv = max(maxv, inputs[i] - minv);
		minv = min(minv, inputs[i]);
	}

//	int maxv = -1000000000;
//	for(int i = 1; i < n; i++) {
//		for(int j = 0; j < i; j++) {
//			int r = inputs[i] - inputs[j];
//			if(maxv<r) {
//				maxv = r;
//			}
//		}
//	}

	cout << maxv << endl;
	return 0;
}





Measured memory_bytes: 3880
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define MOD 1000000007
#define mod 998244353
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define vvi vector<vi>
#define endl "\n"
using namespace std;
void solve1();
void solve()
{
    int T;cin>>T;
    for(int z=1;z<=T;z++)
    {
        solve1();
    }
}
signed main()
{
    std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve1();
    return 0;
}
void solve1()
{
    int n,a=0,b=0;cin>>n;
    string str;cin>>str;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='W')a++;
        else b++;
    }
    if(a==0||b==0)
    {
        cout<<0<<endl;return;
    }
    int ans=min(a,b);
    int me=0;
    int i=0,j=n-1;
    while(i<j)
    {
        if(str[i]=='W'&&str[j]=='R')
        {
            me++;i++;j--;
        }
        else if(str[i]=='W')j--;
        else if(str[j]=='R')i++;
        else
        {
            i++;j--;
        }
    }
    cout<<min(ans,me)<<endl;
}


Measured memory_bytes: 3776
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
int main()
{
  int n;
  cin >> n;
  int A[n];
  ll sum = 0;
  map<int, int> map;
  rep(i, n)
  {
    cin >> A[i];
    map[A[i]]++;
    sum += A[i];
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++)
  {
    int b, c;
    cin >> b >> c;
    sum += (c - b) * map[b];
    cout << sum << endl;
    map[c] += map[b];
    map[b] = 0;
  }

  return 0;
}

Measured memory_bytes: 8396
#include "bits/stdc++.h"
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int x = a + b;
	int y = a * b;
	if (15 == x) {
		cout << "+" << endl;
	}
	else if (15 == y) {
		cout << "*" << endl;
	}
	else {
		cout << "x" << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
using namespace std;

#define LOOP(i,n) for(int i=0;i<(n);i++)
#define ULL unsigned long long
#define LL long long
#define VULL vector<ULL>
#define VLL vector<LL>

struct job{
	ULL a, b;
	bool operator<(struct job arg){
		if (b < arg.b){
			return true;
		}
		else if (b == arg.b)return a < arg.a;
		else return false;
	}
};

int main(void){
	ULL n;
	vector<struct job> ab;

	cin >> n;
	ab.resize(n);
	LOOP(i, n){
		cin >> ab[i].a >> ab[i].b;
	}
	sort(ab.begin(), ab.end());

	bool ans = true;
	ULL sum = 0ULL;

	LOOP(i, n){
		sum += ab[i].a;
		if (sum > ab[i].b){
			ans = false;
			break;
		}
	}
	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 3328
A = 0
def solve(l,c,sa,sb):
    if 2*sa>=A: return 2*sa-A
    if 2*sb>=A: return 2*sb-A
    return min(solve(l,c+1,sa+l[c],sb),solve(l,c+1,sa,sb+l[c]))
while 1:
    n = input()
    if n==0: break
    a = map(int, raw_input().split())
    ans = 10**7; A = sum(a);
    print solve(a,1,a[0],0)

Measured memory_bytes: 4240
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library

#pragma endregion library

int main(){
    ll n,x;cin >> n >> x;
    ll ans = n;
    ll prv = x,now = n-x;
    while(1){
        ll cnt = prv/now;
        ans+=cnt*2*now;
        if(prv%now==0){ans-=now; break;}
        ll nxt = prv - now*cnt;
        prv = now;
        now = nxt;
    }
    cout << ans << '\n';
    
}

Measured memory_bytes: 3508
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, a, b, mxa=0,mxb, ans;
    cin>>n;
    while(n--){
        cin>>a>>b;
        if(a>mxa){mxa=a;mxb=b;}
    }
    ans=mxa+mxb;
    cout<<ans;
}

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

int main() {
  unll n,k;
  cin >> n >> k;
  if( n <= k ){
    cout << 0 << endl;
    return 0;
  }
  vector<int> h(n);
  for(int i=0;i<n;i++){
    cin >> h.at(i);
  }
  
  sort(h.begin(),h.end());
  unll sum=0;
  for(int i=0;i<n-k;i++){
    sum += h.at(i);
  }
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;
using llong = long long;

llong sum;

int main() {

    llong k;

    cin >> k;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int kk = 1; kk <= k; kk++) {
                sum += gcd(i, gcd(j, kk));
            }
        }
    }

    cout << sum << endl;

    return 0;
}


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

n = int(input())
tmp = input()
a=[int(x) for x in tmp.split()]

i=int(0)
x=int(0)

for x in range (n):
    while a[x]%2 == 0:
        i +=1
        a[x] = a[x]/2

print(i)

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

int main() {
    int N; cin >> N;

    vector<int> A(N);
    rep(i, N){
        cin >> A[i];
    }

    int counter = 0;
    rep(i, N){
        int minj = i;
        for (int j = i + 1; j <= N - 1 ; j++){
            if(A[j] < A[minj]){
                minj = j;
            }
        }
        if (i != minj){
            swap(A[i], A[minj]);
            counter++;
        }
    }

    rep(i, N){
        if (i == N - 1){
            cout << A[N - 1] << endl;
        } else {
            cout << A[i] << " ";
        }
    }

    cout << counter << endl;
}


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



int main() {
	int N, M;
	cin >> N >> M;
	vector<int> road_counter(N, 0);
	vector<int> a(M);
	vector<int> b(M);
	for(int i = 0; i < M; i++){
		cin >> a.at(i) >> b.at(i);
		road_counter.at(a.at(i) - 1)++;
		road_counter.at(b.at(i) - 1)++;
	}
	for(int i = 0; i < N; i++){
		cout << road_counter.at(i) << endl;
	}
	return 0;
}

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

#define mo 1000000007
int main()
{
	char arr[1005][1005];
	int dp[1005][1005];
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>arr[i][j];
		}
	}

	memset(dp,0,sizeof(dp));
	dp[1][1] = 1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			
			if(arr[i][j+1] != '#' && i<=n && j <=m)
			{

				dp[i][j+1] = ((dp[i][j+1])%mo + (dp[i][j])%mo)%mo ; 
			}

			if(arr[i+1][j] != '#' && i<=n && j<= m)
			{
				dp[i+1][j] = ((dp[i+1][j])%mo + (dp[i][j])%mo)%mo ;
			}
		}
	}
	// for(int i=1;i<=n;i++)
	// {
	// 	for(int j=1;j<=m;j++)
	// 	{
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	cout<<dp[n][m];
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allg(v) v.begin(), v.end(), greater<int>()



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

  int w, h, n;
  cin >> w >> h >> n;
  vector<vector<int> > vec(w, vector<int>(h)); 
  
  int x, y, a;
  rep(i, 0, n) {
    cin >> x >> y >> a;
    if(a == 1 and x != 0) {
      rep(j, 0, x) {
        rep(k, 0, h) {
          vec[j][k] = 1;
        }
      }
    }
    if(a == 2 and x != w) {
      rep(j, x, w) {
        rep(k, 0, h) {
          vec[j][k] = 1;
        }
      }
    }
    if(a == 3 and y != 0) {
      rep(j, 0, w) {
        rep(k, 0, y) {
          vec[j][k] = 1;
        }
      }
    }
    if(a == 4 and y != h) {
      rep(j, 0, w) {
        rep(k, y, h) {
          vec[j][k] = 1;
        }
      }
    }
  }
  
  int ans = 0;
  rep(i, 0, w) {
    rep(j, 0, h) {
      if(vec[i][j] == 0) ans++;
    }
  }
  
  cout << ans << "\n";

}

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

int main() {
  int n, a;
  cin >> n >> a;

  if ( a >= 500 || n % 500 == 0) {
    cout << "Yes" << endl;
  } else if ( n % 500 < a ) {
      cout << "Yes" << endl;
  } else {
      cout << "No" << endl;
  }
  
  

}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
	int t;
	while(~scanf("%d",&t))
	{
		int c=0,x,d=0;
		for(int i=0;i<t;i++)
		{
			scanf("%d",&x);
			if(x%4==0)
			{
				c++;
			}
			else if(x%2==0)
			{
				d++;
			}
		}
		if(d>=2)t=t-d+1;
		if(c>=(t/2))puts("Yes");
		else puts("No");
	}
} 

Measured memory_bytes: 256
N = int(input())
s = [int(input()) for _ in range(N)]
t = 0
m = 1000
for i in range(N):
    t = t + s[i]
    if s[i] % 10 > 0 and m > s[i]:
        m = s[i]
if t % 10 > 0:
    print(t)
elif m == 1000:
    print(0)
else:
    print(t-m)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nabcd = Add.arL;
        for(var i = 0; i < nabcd[0]; i++)
        {
            var min = (nabcd[0] - 1 - i) * nabcd[3] - i * nabcd[4];
            var max = -i * nabcd[3] + (nabcd[0] - 1 - i) * nabcd[4];
            var dis = nabcd[2] - nabcd[1];
            if (min <= dis && dis <= max)
            {
                WriteLine("YES");
                return;
            }
        }
        WriteLine("NO");
    }
}

public class Add
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

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

	cout << max({a+b,a+a-1,b+b-1}) << endl;

	return 0;
}

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

using namespace std;

typedef long long int ll;

#define mod (int ) (1e9+7)


 
 ll ncr(ll x, ll y){
 	ll ans=1;
 	
 	y=(y > x-y? x-y: y);
 	
 	for(ll i=0; i<y; i++){
 		ans=ans*(x-i);
 		ans=ans/(i+1);
 		ans=ans%mod;
 	}
 
 	
 	return ans;
 }

ll power(ll x, ll y){
    ll ans=1;
    while(y){
        if(y&1){
            ans=ans*x;
            ans=ans%mod;
        }
        
        x=x*x;
        x=x%mod;
        y=y>>1;
    }
    
    return ans;
    
}
 
void solve(){

  ll n; cin>>n;
  
  map<int, int>m;
  
  set<int>s;
  
  for(int i=0; i<n; i++){
  	ll x; cin>>x;
  	s.insert(x);
  	m[x]+=1;
  }
  
 // cout<<m[4]<<endl;
  
  vector<ll>v;
  
  for(auto it:s){
  	//cout<<it<<"\n";
  	v.push_back(it);
  }
  
  ll ans=0;
  
  if(v.size()<3){
  	cout<<"0"<<"\n";
  	return;
  }
  
  for(int i=0; i<=v.size()-3; i++){
  	for(int j=i+1; j<=v.size()-2; j++){
  		for(int k=j+1; k<=v.size()-1; k++){
  			if(v[i]+v[j]>v[k]){
  				
  				ans=ans+ (m[v[i]]*(m[v[j]]*m[v[k]]));
  			}
  		}
  	}
  	
  }
  
  cout<<ans<<"\n";
  
  

    return ;
	
}

int main(){
    ios_base::sync_with_stdio(0);
    
    cin.tie(0);
    
    int t=1; //cin>>t; 
    
   
    
    // clock_t begin, end;
    
    // double time_spent;
    
    // begin = clock(); // Time taken till now.
    
    
    while(t--){
    	
	  solve();
        
    }
   
   //end= clock(); // Total  Time taken till now.
   
   //time_spent= (end- begin) / CLOCKS_PER_SEC;
   
   //cout<<time_spent<<"\n";
	
	return 0;
}

Measured memory_bytes: 3628
# ABC150 D
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from fractions import gcd
from math import ceil
def lcm(x, y):
    return (x * y) // gcd(x, y)
n,m=nm()
a=nl()
ans=0
a=[x//2 for x in a] 

lcm_v=a[0]
for i in range(n):
    lcm_v=lcm(lcm_v,a[i])
ok_flg=[(lcm_v//i)%2==1 for i in a]
if all(ok_flg):
    ans=((m//lcm_v)+1)//2
print(ans)



Measured memory_bytes: 16276
#include<iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;
    long long int A[N], a = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N - 1; i++){
        if(A[i] > A[i + 1]){
            a += A[i] - A[i + 1];
            A[i + 1] = A[i];
        }
    }
    cout << a;
}

Measured memory_bytes: 5160
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9+7

ans = 1
dp = [0]*3
for a in A:
    ans = ans*dp.count(a) % MOD
    try:
        dp[dp.index(a)] += 1
    except ValueError:
        break
print(ans)


Measured memory_bytes: 52908
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;


int main() {
	long long  n, k;
	pair<int, int> p[200000];
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> p[i].first >> p[i].second;
	}
	sort(p, p + n);
	long long kk = k;
	for (int i = 0; i < n; i++) {
		kk -= p[i].second;
		if (kk <= 0) {
			cout << p[i].first;
			break;
		}
	}
}

Measured memory_bytes: 1792
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i += 2) {
		if(s.length()-i>=0)cout << s[i];
	}
}

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

int main(){
  int n,d;
  cin >> n >> d;
  int ans;
  if(n%(d*2+1) == 0){
    cout << n/(d*2+1) << endl;
  }else{
    cout << n/(d*2+1)+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void swap(int,int);
int A[100],c=0;

main(){
  int i,j,n;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<n-1;i++){
    for(j=n-1;j>=i+1;j--){
      if(A[j]<A[j-1]) swap(j,j-1);

    }
  }

  for(i=0;i<n;i++){
    if(i==n-1) {
      printf("%d",A[i]);
      break;
    }
    printf("%d ",A[i]);
  }
  printf("\n%d\n",c);

  return 0;
}

void swap(int x,int y){
  int tmp;

  tmp=A[x];
  A[x]=A[y];
  A[y]=tmp;

  c++;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 1000000;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++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;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

LL powmod(LL n, LL p) {
    if( p == 0 ) return 1;
    if( p % 2 == 0 ) {
        LL t = powmod(n, p / 2);
        return t * t % MOD;

    }
    return n * powmod(n, p - 1);
}

LL mdiv(LL a, LL b) {
    LL exp = MOD - 2;
    while( exp ) {
        if( exp % 2 ) {
            a *= b;
            a %= MOD;

        }
        b *= b;
        b %= MOD;
        exp /= 2;
    }
    return a;
}

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

    LL n;
    LL a, b;
    cin >> n >> a >> b;

    LL t = (powmod(2ll, n) - 1) % MOD;
    LL m = 1;
    LL tmp = n;
    for( int i = 1; i <= a; ++i ) {
        m *= tmp;
        m %= MOD;
        tmp--;
        m = mdiv(m, i);

    }
    m %= MOD;

    LL mm = 1;
    tmp = n;
    for( int i = 1; i <= b; ++i ) {
        mm *= tmp;
        mm %= MOD;
        tmp--;
        mm = mdiv(mm, i);
    }
    m += mm;
    m %= MOD;
    mm %= MOD;
    t -= m;

    if( t < 0 ) t += MOD;
    cout << t % MOD << endl;
    
    return 0;
}



Measured memory_bytes: 384
n = int(input())
x, y, h = [], [], []
for _ in range(n):
    a, b, c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)


for cx in range(101):
    for cy in range(101):
        for i in range(n):
            ch = h[i] + abs(x[i] - cx) + abs(y[i] - cy)
            if all(h[j] == max(ch - abs(x[j] - cx) - abs(y[j] - cy), 0) for j in range(n)):
                print(cx, cy, ch)
                exit()


Measured memory_bytes: 72156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Grid
{
    private bool[,,] grid = new bool[5, 5, 4];
    private readonly int[] dx = { 1, 0, -1, 0 };
    private readonly int[] dy = { 0, 1, 0, -1 };
    private int x, y, d;
    private readonly string sd = "RDLU";

    public void MakeGrid()
    {
        for (int i = 0; i < 9; i++)
        {
            string input = Console.ReadLine();
            if ((i & 1) == 0)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (input[j] == '1')
                    {
                        grid[i / 2, j, 0] = grid[i / 2, j + 1, 2] = true;
                    }
                }
            }
            else
            {
                for (int j = 0; j < 5; j++)
                {
                    if (input[j] == '1')
                    {
                        grid[i / 2, j, 1] = grid[i / 2 + 1, j, 3] = true;
                    }
                }
            }
        }
    }

    public void Solve()
    {
        do
        {
            for (int i = 0; i < 4; i++)
            {
                int t = (i + d + 3) % 4;
                if (grid[y, x, t])
                {
                    d = t;
                    x += dx[d];
                    y += dy[d];
                    Console.Write(sd[d]);
                    break;
                }
            }
        } while (!(x == 0 && y == 0));
        Console.WriteLine();
    }
}

class Program
{
    static void Main(string[] args)
    {
        Grid grid = new Grid();
        grid.MakeGrid();
        grid.Solve();
    }
}


Measured memory_bytes: 8660
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

LL n, m, p;
 
LL a[5050], b[5050], c[5050];
 
LL d[5050];
bool to_goal[5050];
int main(){
	cin >> n >> m >> p;
	REP(i, m){
		cin >> a[i] >> b[i] >> c[i];
		a[i]--, b[i]--;
		c[i] = -(c[i] - p);
	}
	REP(i, n)d[i] = HINF<LL>();
	d[0] = 0;
	LL ans = 0;
    to_goal[n - 1] = true;
	REP(i, 10 * n)REP(j, m){
        if(to_goal[b[j]])to_goal[a[j]] = true;
		if(d[a[j]] != HINF<LL>() && d[b[j]] > d[a[j]] + c[j]){
			d[b[j]] = d[a[j]] + c[j];
			if(i >= 9 * n && to_goal[b[j]]){
				cout << "-1" << endl;
				return 0;
			}else if(b[j] == n - 1){
				ans = max(ans, -d[n - 1]);
			}
		}
	}
	cout << ans << endl;
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  }

  bool possible = true;
  for (int i = n - 1; i >= 1; --i) {
    if (h[i] < h[i - 1] - 1) {
      possible = false;
      break;
    } else if (h[i] < h[i - 1]) {
      --h[i - 1];
    }
  }

  cout << (possible ? "Yes" : "No");

  return 0;
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
    abc124c()
}

fun abc124c() {
    val black = '0'
    val isBlackList = readLine()!!.toCharArray().map { it == black }

    // 最初がblack(0101..のパターン)への塗替えが必要な数
    val firstBlack = isBlackList.filterIndexed { index, isBlack ->
        val needBlack = index % 2 == 0
         needBlack != isBlack
    }.count()

    // 最初がwhite(1010..のパターン)への塗替えが必要な数
    val firstWhite = isBlackList.filterIndexed { index, isBlack ->
        val needBlack = index % 2 != 0
        needBlack != isBlack
    }.count()

    println(Math.min(firstBlack, firstWhite))
}


Measured memory_bytes: 36628