akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int input;
		int count = 0;
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()){
			input = scanner.nextInt();
			boolean[] check = new boolean[input];
			Arrays.fill(check, true);
			check[0] = false;
			for( int i=0; i<input; i++){
				if(check[i] == true){
					count++;
					for( int j=i; j<input; j+=i+1){
						check[j] = false;
					}
				}
			}
			System.out.println(count);
			count = 0;
		}
	}
}

Measured memory_bytes: 35508
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */

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

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

signed main()
{
  ios::sync_with_stdio(false);
  int a, b, c;

  while (cin >> a >> b >> c, a || b || c){
    int dia[3] = {sqrt(a * a + b * b), sqrt(b * b + c * c), sqrt(c * c + a * a)};
    int n;
    cin >> n;
    int m = *min_element(dia, dia + 3);
    REP(i, n){
      int r;
      cin >> r;
      if (r * 2 > m) print("OK");
      else print("NA");
    }
  }

  return (0);
}

Measured memory_bytes: 1172
/*"Everything in the universe is balanced. Every disappointment
   you face in life will be balanced by something good for you!
                Keep going, never give up."            */

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

#define ll long long int
#define rep(i,a,b) for(int i=a; i<=b; ++i)
#define repd(i,a,b) for(int i=a; i>=b; --i)
#define nl '\n'
#define pb push_back
#define all(a) a.begin(),a.end()
#define P pair<ll,ll> 
#define F first
#define S second
const ll N=1e6+9;
const ll mod=1e9+7;
ll powerk(ll x, ll y);
ll mul(ll x, ll y);
ll add(ll x, ll y);
ll sub(ll x, ll y);

void solve()
{    
  ll n,m;
  cin>>n;
  ll a[n+1],dp[n+1][n+1];
  rep(i,1,n)cin>>a[i],a[i]+=a[i-1];
  rep(i,1,n)rep(j,1,n)dp[i][j]=(i==j?0:1e18);
  //cout<<go(1,n)<<nl;
  //memset(dp,0x3f,sizeof dp);
  //rep(i,1,n)dp[i][i]=0;
  rep(i,2,n){
  	rep(j,i,n){
  		ll k = j-i+1 ;
  		rep(l,k,j-1){
  			if(dp[k][j]>a[j]-a[k-1]+dp[k][l]+dp[l+1][j]){
  				dp[k][j] = dp[k][l]+dp[l+1][j]+a[j]-a[k-1];
  			}
  			//if(k==1 && j==4)cout<<dp[k][j]<<" "<<dp[k][j]<<nl;
  		}
   	}
  }
  cout<<dp[1][n];
 
}


int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t=1;
    //pre();
    //cin>>t;
    while(t--)
    {
      solve();
    }  
}
ll mul(ll x, ll y){return (x*y)%mod;}
ll add(ll x, ll y){return (x+y)%mod;}
ll sub(ll x, ll y){return (x-y+mod)%mod;}
ll powerk(ll x, ll y)
{
  if(y==0)return 1;
  if(y==1)return x%mod;
  if(y&1)
    return ((powerk((x*x)%mod, y/2)%mod)*x)%mod;
  else return powerk((x*x)%mod,y/2)%mod;
}

// Xorawar

Measured memory_bytes: 1536
N = int(input())
S = [input() for _ in range(N)]
 
from collections import Counter
 
nS = []
for s in S:
    s  = ''.join(sorted(s))
    nS.append(s)

c = Counter(nS)
 
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

acc = 0
for cnt in list(c.values()):
    if cnt!=1:
        acc+=cmb(cnt, 2)
    
print(acc)

Measured memory_bytes: 26872
program Frog_2
    implicit none
    integer(4):: n,k
    integer(4):: i,j
    integer(4),parameter:: inf=200000*10000+1
    integer(4), allocatable:: h(:), dp(:)


    read*, n,k
    allocate(h(n), dp(n))

    read*, h(:)
    dp(:) = inf
    dp(1) = 0
    do i=1,n
        do j=1,k
            if (i+j > n) cycle
            dp(i+j) = min(dp(i+j), dp(i) + abs(h(i)-h(i+j)))
        end do
    end do

    print*, dp(n)

end program Frog_2

Measured memory_bytes: 1536
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string s, t;
    int a, b;
    string u;

    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if (s == u) {
        a--;
    }
    else {
        b--;
    }
    cout << a << " " << b << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n,x,y,count=0,ans=0;
	cin>>n;
	cin>>y;
	for(int i=0;i<n-1;i++)
	{
		cin>>x;
		if(x<=y)
		count++;
			if(ans<count)
		ans=count;
		if(x>y)
		count=0;
		y=x;
	}
	if(n==1)
	cout<<"0";
	else
	cout<<ans;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    string s; cin >> s;
    ll bc = 0;
    ll res = 0;
    REP(i, s.size()) {
        if (s[i] == 'B') {
            bc++;
        } else {
            res += bc;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static long sum(long x)
        {
            long r = 0;
            while (x > 0)
            {
                r += x % 10;
                x /= 10;
            }
            return r;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var input = Reads();
            var n = input[0];
            var a = input[1];
            var b = input[2];
            long anwer = 0;
            for (int i = 1; i <=n; i++)
            {
                if (a <= sum(i) && sum(i) <= b)
                    anwer+=i;
            }
            Console.WriteLine(anwer);
          
            
        
   

           



            Console.Out.Flush();
        }
    }
}


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

const int INF = 2e9;

//sortの比較関数: first昇順、second降順
bool comp(pair<int, string> a, pair<int, string> b){
    /* if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    } */
    return a.second > b.second;
} 

int main(){
    //入力
    int N, M; cin >> N >> M;
    vector<int> A(M);
    for(int i = 0; i < M; i++) cin >> A[i];

    map<int,int> F; // F[i] := 数字iを作るのに使うマッチ数
    F[1] = 2, F[2] = 5, F[3] = 5,F[4] = 4, F[5] = 5,
    F[6] = 6, F[7] = 3, F[8] = 7, F[9] = 6;

    vector<int> dp(N+1, -INF); // dp[i] := マッチ棒をi本使って作れる数の最大の桁数
    string ans = "";

    //dpテーブルを埋めていく
    dp[0] = 0;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j < M; j++){
            if(i - F[A[j]] >= 0) dp[i] = max(dp[i], dp[i-F[A[j]]] + 1);
        }
    }

    //前処理(数字がなるべく大きい方が辞書順が大きくなるので、数字が大きいものを先に並べておく)
    sort(A.begin(), A.end(), greater<int>());

    // dpテーブルが動いた時に数字は追加されているのでそれを逆に辿る
    int remain = dp[N]; // 残り桁数
    int match = N;      // 残りマッチ数
    while(match > 0){
        for(int i = 0; i < M; i++){
            if( match - F[A[i]] >= 0 && dp[match - F[A[i]]] == remain - 1){
                ans += string{(char)(A[i] + '0')};
                match -= F[A[i]];
                remain--;
                break;
            }
        }
    }

    //　最大桁数の中で辞書順最大なものを出力したい
    sort(ans.begin(), ans.end());
    reverse(ans.begin(), ans.end());

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
using namespace std;
int main()
{
	int N,M;
	cin>>N>>M;
	int ans=0;
	priority_queue<int>q;
	vector<vector<int>>mn(1e+5+1);
	rep(i,N){
		int a,b;
		cin>>a>>b;
		if(a<=M){
		mn[a].push_back(b);
		}
	}
	for(int i=1;i<=M;i++){
		for(int j=0;j<mn[i].size();j++){
			q.push(mn[i][j]);
			}
		if(!q.empty()){
			ans+=q.top();
			q.pop();
			}
	}
	cout<<ans<<endl;

	


	







}




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

int main(){
    ll n,i;
    cin>>n;
    ll a[n];
	for(i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	ll p=1;
	ll cou=1000000000000000000;
	for(i=0;i<n;i++){
		p*=a[i];
		if(p>=1000000000000000000&&(i!=n-1)){
	        cout<<"-1"<<endl;
	        return 0;
        }
		if(a[i]==0){
			cout<<'0'<<endl;
			return 0;
		}
		cou/=a[i];
		if(cou<1){
			cout<<"-1"<<endl;
			return 0;
		}
		
	} 
	if(p>1000000000000000000){
	    cout<<"-1"<<endl;
	    return 0;
	}
	if(p<0)p=-1;
    cout<<p<<endl;
	return 0;
}

Measured memory_bytes: 4416
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  f              first                 
#define  s              second
#define  endl           "\n"
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;            
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  unordered_map<ll,ll>  um;
typedef  vector<pll>           vpll;
 
const ll   N     =  3e5+5;
const ll   mod   =  1e9+7;
const ll   INF   =  1e18;
const int  INFi  =  0x7f7f7f7f;

ll test = 1, n, ans[N];

void solve(){
	cin>>n;
	for(int i = 1; i*i < n; i++){
		for(int j = 1; j*j < n; j++){
			for(int k = 1; k*k < n; k++){
				ll x = i*i+j*j+k*k+i*j+i*k+j*k;
				if(x > n) break;
				ans[x]++;
			}
		}
	}
	for(int i = 1; i <= n; i++) deb1(ans[i])
}

int main(){
	fastio;
	//cin>>test;
	for(int i = 1; i <= test; i++){
		solve();
	}
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define FOD(i,a,b) for(int i=a; i>=b; i--)
#define pa pair<int,int>
#define fi first
#define se second
#define MOD xxx
#define getbit(n,i) ((n>>(i-1))&1)
#define offbit(n,i) ((n^(1<<(i-1))
#define onbit(n,i) (n|(1<<(i-1)))
#define cntone(x) (__builtin_popcount(x))

using namespace std;
LL a,b;
int main()
{
    cin >> a >> b;
    cout << a*b;
	return 0;
}

Measured memory_bytes: 3636
import bisect

n,m,k=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
acum1=[0]
for i in range(n):
  acum1.append(acum1[-1]+arr1[i])
acum2=[0]
for i in range(m):
  acum2.append(acum2[-1]+arr2[i])
ans=0
j=m
for i in range(n+1):
  if acum1[i]>k:
    break
  while acum2[j]>k-acum1[i] and j>0:
    j-=1
  ans=max(ans,i+j)
print(ans)

Measured memory_bytes: 47332
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] h = new int[N];
	int hMax = 0;
	for(int i = 0; i<N; i++) {
	    h[i] = sc.nextInt();
	    hMax = Math.max(h[i], hMax);
	}

	int height = 0;
	int shima = 0;
	for(int k = 0; k<hMax; k++) {
	    boolean isConnect = false;
	    for(int i = 0; i<N; i++) {
		if(h[i]-height > 0 ) {
		    if(isConnect == false) shima++;
		    isConnect = true;
		}else {
		    isConnect = false;
		}
	    }
	    height++;
	}
	System.out.println(shima);
    }
}

Measured memory_bytes: 23124
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
string s[10]={
  {"* = ****"},
  {"* =* ***"},
  {"* =** **"},
  {"* =*** *"},
  {"* =**** "},
  {" *= ****"},
  {" *=* ***"},
  {" *=** **"},
  {" *=*** *"},
  {" *=**** "},
};
int main(){
  char in[5]={0};
  bool a=false;
  while(cin>>in){
    if(a)cout<<endl;
	a=true;
    int h=strlen(in);
	rep(i,8){
      rep(j,5-h)cout<<s[0][i];
	  rep(j,h)cout<<s[in[j]-'0'][i];
	  cout<<endl;
	} 
  }
}

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

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)


int main() {
  int H,W;
  char ss;
  cin >> H >> W;
  int cnt=0;
  vector<vector<int>> s(H+1,vector<int> (W+1,1)),vd(H+1,vector<int> (W+1,0));

  rep(i,H){
    rep(j,W) {
      cin >> ss;
      if (ss=='.') {
        s[i][j]=0;
        cnt++;}
    }
  }
  
  queue<vector<int>> q;
  q.push({0,0,1});
  vd[0][0] += 1;
  vector<int> tmp;
  int x,y,sc;
  while(!q.empty()) {
    tmp = q.front();
    q.pop();
    x = tmp[0];y = tmp[1];sc = tmp[2];
    if (x+1<H && s[x+1][y]==0 && vd[x+1][y]==0) {
      vd[x+1][y] += sc+1;
      q.push({x+1,y,sc+1});
    }
    if (x-1>=0 && s[x-1][y]==0 && vd[x-1][y]==0) {
      vd[x-1][y] += sc+1;
      q.push({x-1,y,sc+1});
    }
    if (y+1<W && s[x][y+1]==0 && vd[x][y+1]==0) {
      vd[x][y+1] += sc+1;
      q.push({x,y+1,sc+1});
    }
    if (y-1>=0 && s[x][y-1]==0 && vd[x][y-1]==0) {
      vd[x][y-1] += sc+1;
      q.push({x,y-1,sc+1});
    }
  }
  if (vd[H-1][W-1]) cout << cnt-vd[H-1][W-1] << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] da_str = in.nextLine().split(" ");
		double[] da = new double[4];
		for(int i=0;i<da_str.length;i++) {
			da[i] = Double.parseDouble(da_str[i]);
		}
		double d = Math.sqrt(Math.pow(da[2] - da[0], 2.0) + Math.pow(da[3] - da[1], 2.0));
		System.out.println(d);
	}
}

Measured memory_bytes: 26144
A, B, M = input().split(' ')
A = int(A)
B = int(B)
M = int(M)
a = input().split(' ')
a = [int(a[i]) for i in range(A)]
b = input().split(' ')
b = [int(b[i]) for i in range(B)]
cost = min(a) + min(b)
for i in range(M):
  x, y, c = input().split(' ')
  x = int(x)-1
  y = int(y)-1
  c = int(c)
  if a[x] + b[y] - c < cost:
    cost = a[x] + b[y] - c
print(cost)

Measured memory_bytes: 24680
#include <stdio.h>
int main(){
  int n,j,i,count=0 ,res[100],minj,alg;
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&res[i]);
  }
  
  for(i=0;i<=n-1;i++){
    minj = i;
    for(j=i;j<=n-1;j++){
      if(res[j]<res[minj]){
      minj = j;
      }
    }
    if(i!=minj) {
      alg = res[i];
      res[i] = res[minj];
      res[minj] = alg;
      count++;
      }
    }
  




  
  for(i=0;i<n;i++){
    printf("%d",res[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 604
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	int d=sc.nextInt();
	int n=sc.nextInt();
	if(d==0){
		d=1;
	}else if(d==1){
		d=100;
	}else{
		d=10000;
	}
	if(n==100){
		n++;
	}
	System.out.println(d*n);

	}}

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

int main() {
  int n,m; cin>>n>>m;
  int ans=n+m;
  if (ans>=24) ans-=24;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           GHC.Base
import           System.IO

import qualified Data.Array    as A
import qualified Data.IntMap   as I
import qualified Data.Map      as M
import qualified Data.Set      as S
import qualified Data.Vector   as V

readT :: Read a => T.Text -> a
readT = read . T.unpack

getLineSpc :: Read a => IO [a]
getLineSpc = do
  t <- T.getLine
  let xs = map readT $ T.split (== ' ') t
  return xs

getLineSpcVec :: Read a => IO (V.Vector a)
getLineSpcVec = do
  t <- T.getLine
  let xs = V.fromList $ map readT $ T.split (== ' ') t
  return xs

main :: IO ()
main = twoCoins

twoCoins :: IO ()
twoCoins = do
  abc :: V.Vector Int <- getLineSpcVec
  let [a, b, c] = abc
  if a + b < c
    then
    putStrLn "No"
    else
    putStrLn "Yes"

Measured memory_bytes: 508
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll long long
#define Graph vector<vector<long long>>
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define inf 5000000321
#define mod107 1000000007;

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

int main(){
    int N;
    cin >> N;
    vector<pair<int,int>> D(N);
    bool ok = false;
    for(int i =0 ;i <N;i++){
        int a,b;
        cin >> a >> b;
        D[i] = make_pair(a,b);
    }
    int str = 0;
    for(int i = 0;i < N;i++){
        if(D[i].first == D[i].second){
            str++;
            if(str >= 3)ok = true;
        }
        else{
            str = 0;
        }
        
    }
    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout <<"No" << endl;
    }
}


Measured memory_bytes: 3596
import java.util.LinkedList;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;

class Graph2 {
	private int totalVertex;
	//adjMatrix[u][v] = 1 if there is an edge from u to v, otherwise 0
	private int[][] adjMatrix;
	//adjWeight[u][v] -- the weight of the edge from u to v if there is one
	private int[][] adjWeight;
	//if a node is settled (e.g., processed in the Dijkstra's algorithm)
	private Boolean[] ifSettled;
	public Graph2() { totalVertex = 0; }
	public int getTotalVertex() { return totalVertex; }
	//load graph from standard input
	public void loadAdjMatrix() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjMatrix = new int[totalVertex][totalVertex];
		adjWeight = new int[totalVertex][totalVertex];
		ifSettled = new Boolean[totalVertex];
		int i, j;
		for(i = 0; i < totalVertex; i ++) {
			ifSettled[i] = false;
			for(j = 0; j < totalVertex; j ++) {
				adjMatrix[i][j] = adjWeight[i][j] = 0;
			}
		}
		for(i = 0; i < totalVertex; i ++) {
			for(j = 0; j < totalVertex; j ++) {
				int v = in.nextInt();
				if (v != -1) {
					adjMatrix[i][j] = 1;
					adjWeight[i][j] = v;
				}
			}	
		}
		in.close();
	}
	//return weight of the edge from u to v if there is one
	public int getWeight(int u, int v) {
		return adjWeight[u][v];
	}
	//return neighbors of u as a LinkedList
	public LinkedList<Integer> getNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if(adjMatrix[u][v] == 1) tmp.add(v);
		}
		return tmp;
	}
	//return unsettled neighbors of u as a LinkedList
	public LinkedList<Integer> getUnsettledNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if((adjMatrix[u][v] == 1) && (ifSettled[v] == false)) tmp.add(v);
		}
		return tmp;
	}
	//return the unsettled node that has the smallest dist
	public int getUnsettledNearest(int[] dist) {
		int md = Integer.MAX_VALUE;
		int mv = -1;
		int v;
		for(v = 0; v < totalVertex; v ++) {
			if((ifSettled[v] == false) && (dist[v] < md)) {
				md = dist[v];
				mv = v;
			}
		}
		return mv;
	}
	//implement the following	
	public int Dijkstra(int s) {
		int total = 0;
		int[] dist = new int[totalVertex];
		
		for(int i =0; i < totalVertex; i++) {
			dist[i] = Integer.MAX_VALUE;
		}
		dist[s] = 0;
		ArrayList<Integer> unsettled = new ArrayList<Integer>(totalVertex);
		for(int j = 0; j < totalVertex; j++) {
			unsettled.add(j);
		}
		while(unsettled.isEmpty() == false) {
			int a = getUnsettledNearest(dist);
			unsettled.remove(unsettled.indexOf(a));
			if(dist[a] == Double.MAX_VALUE) {
				break;
			}
			ifSettled[a] = true;
			
			LinkedList<Integer> list = getUnsettledNeighbors(a);
				for(int k = 0; k < list.size(); k++) {
					dist[list.get(k)] = Math.min(getWeight(list.get(k), a), dist[list.get(k)]); 
			}
		}
		for (int p : dist) total += p;
			return total;
		
		
	}
}

public class Main {
	public static void main(String[] argv) {
		Graph2 g = new Graph2();
		g.loadAdjMatrix();
		int dist = g.Dijkstra(0);
		System.out.println(dist);
	
	}
}


Measured memory_bytes: 41316
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
using namespace std;

int main(){
    int n;
    string str;
    string s,t;
    cin >> n;
    cin >> s >> t;
    for(int i=0;i<n;i++){
        str += s.substr(i,1) +t.substr(i,1);
    }
    cout << str;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<set>
#include <algorithm>
#define ll long long 
using namespace std;
int main()
{
	ll int k,s=0,p,q,r;
	cin>>k;
	for(p=1;p<=k;p++)
	{
		for(q=1;q<=k;q++)
		{
			for(r=1;r<=k;r++)
			{
				s+=__gcd(p,__gcd(q,r));
				
			}
		}
	}
	cout<<s<<endl;
	
}




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

using namespace std;
using ll = long long;


int main() {

    ll  a, b, k;
    cin>>a>>b>>k;
    if (a >= k) {
      cout<<a-k<<" "<<b<<endl;
    }
    else {
      ll b1 = k - a;
      if (b1 >= b) {
        cout<<0<<" "<<0<<endl;
      }
      else {
        cout<<0<<" "<<b-b1<<endl;
      }
    }

  return 0;
}


Measured memory_bytes: 256
MAX_DIFF = 80
h, w = map(int, input().split())

a = [list(map(int, input().split())) for i in range(h)]
b = [list(map(int, input().split())) for i in range(h)]
c = [[abs(a[i][j]-b[i][j]) for j in range(w)] for i in range(h)]

mask = (1 << (h+w)*MAX_DIFF)-1
sets = [[0 for j in range(w)] for i in range(h)]
sets[0][0] = (1 << MAX_DIFF+c[0][0]) | (1 << MAX_DIFF-c[0][0])
for i in range(1, h):
    sets[i][0] |= (sets[i-1][0] << MAX_DIFF+c[i][0]
                   ) | (sets[i-1][0] << MAX_DIFF-c[i][0])
for i in range(1, w):
    sets[0][i] |= (sets[0][i-1] << MAX_DIFF+c[0][i]
                   ) | (sets[0][i-1] << MAX_DIFF-c[0][i])
for i in range(1, h):
    for j in range(1, w):
        sets[i][j] |= (sets[i-1][j] << MAX_DIFF+c[i][j]
                       ) | (sets[i-1][j] << MAX_DIFF-c[i][j])
        sets[i][j] |= (sets[i][j-1] << MAX_DIFF+c[i][j]
                       ) | (sets[i][j-1] << MAX_DIFF-c[i][j])


s = bin(sets[h-1][w-1]+(1 << (h+w)*MAX_DIFF))
min_diff = 1 << MAX_DIFF
for i in range(len(s)):
    if s[-1-i] == '1':
        min_diff = min(min_diff, abs(i-(h+w-1)*MAX_DIFF))
print(min_diff)

Measured memory_bytes: 53212
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
string C[100];
int H,W;
int main(){
   cin>>H>>W;
   REP(i,H){
       cin>>C[i];
   }
   int dx[8]={0,0,1,1,1,-1,-1,-1};
   int dy[8]={1,-1,0,1,-1,0,1,-1};
   REP(i,H){
       REP(j,W){
           int count=0;
           REP(k,8){
               int xx=j+dx[k];
               int yy=i+dy[k];
               if(xx<0||xx>=W)continue;
               if(yy<0||yy>=H)continue;
               if(C[yy][xx]=='#')count++;
           }
           if(C[i][j]=='.')C[i][j]=('0'+count);
           cout<<C[i][j];
       }
       cout<<endl;
   }
   return(0);
}

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

int main() {
  int n;
  cin >> n;
  if(n % 2 == 1) {
    cout << "No" << endl;
  } else {
    string s;
    cin >> s;
    string sf = s.substr(0, n / 2);
    string sb = s.substr(n / 2 , n / 2);
    cout << (sf == sb ? "Yes" : "No") << endl;
  }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
void Main(){
    int N = read(), M = read(), ans;
    for (int i = M/N; i>0; i--) {
        if(M%i==0 && M/i >= N) {
            ans = i;
            break;
        }
    }
    printf("%d\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

const int MN = 1000005;

int N;
char S[MN];

int p[MN];
inline int Solve(int lb) {
	p[N] = 0;
	for (int i = N; i >= 1; --i)
		p[i - 1] = std::max(p[i] + (S[i] == '1' ? 1 : -1), 0);
	int maxval = 0;
	for (int i = 1, now = 0; i <= N; maxval = std::max(maxval, now), ++i)
		if (S[i] == '?') now += now - 1 - p[i] >= lb ? -1 : 1;
		else now += S[i] == '0' ? 1 : -1;
	return maxval;
}

int main() {
	scanf("%s", S + 1), N = strlen(S + 1);
	int minval = 0;
	for (int i = 1, now = 0; i <= N; ++i)
		if (S[i] == '1') minval = std::min(minval, --now);
		else ++now;
	printf("%d\n", std::min(Solve(minval) - minval, Solve(minval - 1) - minval + 1));
	return 0;
}

Measured memory_bytes: 6616
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    cin >> n;
    map<string, int> blue;
    for(int i = 0; i < n; i++){
        string a;
        cin >> a;
        blue[a] += 1;
    }
    int x;
    cin >> x;
    for(int i = 0; i < x; i++){
        string a;
        cin >> a;
        blue[a] -= 1;
    }
    
    int max_v = 0;
    for(auto i = blue.begin(); i != blue.end(); i++){
        max_v = max(i -> second, max_v);
    }
    cout << max_v << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

//解説参考.
int main(){
	int n;
	cin>>n;
	
	vector<llong> a(n);
	REP(i,n) cin>>a[i];
	
	vector<vector<llong> > dp(n,vector<llong>(2));
	dp[0][0]=dp[0][1]=0;
	dp[1][0]=a[0];
	dp[1][1]=a[1];
	for(int i=2;i<n;++i){
		if(i&1){
			dp[i][0]=dp[i-2][0]+a[i-1];
			dp[i][1]=dp[i-1][0]+a[i];
		}else{
			dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
			dp[i][1]=max(dp[i-2][0],dp[i-2][1])+a[i];
		}
	}
	
	/*REP(i,n) cout<<dp[i][0]<<' ';
	cout<<endl;
	REP(i,n) cout<<dp[i][1]<<' ';
	cout<<endl;*/
	
	cout<<max(dp[n-1][0],dp[n-1][1])<<endl;
}

Measured memory_bytes: 15620
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



int main() {

	ll N;
	cin >> N;
	string S[3];
	cin >> S[1] >> S[2];

	ll dp[100] = {};

	if (S[1][0] != S[2][0]) { dp[0] = 6; }
	else { dp[0] = 3; }

	repn(i, N - 1) {
		
		ll c;

		char x = S[1][i - 1];
		char y = S[2][i - 1];
		char z = S[1][i];
		char w = S[2][i];

		if (x == y) { c = 2; }
		else if (x == z) { c = 1; }
		else if (y == w) { c = 1; }
		else if (z == w) { c = 1; }
		else { c = 3; }

		dp[i] = dp[i - 1] * c%MOD;

	}

	cout << dp[N - 1];


	system("PAUSE");
}






Measured memory_bytes: 504
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <unordered_map>

using namespace std;

int main() {
	int N;
	cin >> N;
	
	unordered_map<int, int> mp;
	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		long long int a;
		cin >> a;

		if (mp[a] % 2 == 0) {
			ans++;
		}
		else {
			ans--;
		}
		mp[a]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4388
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    l, r = [int(x) for x in input().split()]
    if r - l + 1 >= 5000:
        print(0)
    else:
        M = 2019
        mn = []
        for i in range(l, r + 1):
            for j in range(i+1, r + 1):
                mn.append((i*j)%M)

        mn.sort()
        print(mn[0])
        



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""


Measured memory_bytes: 87244
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    s = input().strip()
    if s[:2] == 'SU':
        print(7)
    elif s[:2] == 'MO':
        print(6)
    elif s[:2] == 'TU':
        print(5)
    elif s[:2] == 'WE':
        print(4)
    elif s[:2] == 'TH':
        print(3)
    elif s[:2] == 'FR':
        print(2)
    elif s[:2] == 'SA':
        print(1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int N;
cin >> N;
vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
    cout << a[N-1] - a[0] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

/* --------------------------------------- */

ll n, m;
set<pair<ll, P>> edges;

class union_find {
public:
	union_find(int n)
	: par_(n, -1)
	{}
	void init(int n) {
		par_.assign(n, -1);
	}

	int root(int x) {
		return par_[x] < 0 ? x : par_[x] = root(par_[x]);
	}

	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if(x == y) {
			return false;
		} else {
			if(par_[x] < par_[y]) {
				par_[x] += par_[y];
				par_[y] = x;
			} else {
				par_[y] += par_[x];
				par_[x] = y;
			}
			return true;
		}
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	int size(int x) {
		return -par_[root(x)];
	}

private:
	std::vector<int> par_;
};

ll kruskal(vector<pair<ll, P>>& mst_edges) {
	union_find uf(n);
	ll ret = 0;
	for(auto edge: edges) {
		ll cost = edge.first;
		ll a = edge.second.first, b = edge.second.second;
		if(uf.same(a, b)) continue;
		uf.unite(a, b);
		ret += cost;
		mst_edges.pb(edge);
	}
	return ret;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	REP(i, m) {
		ll s, d, c;
		cin >> s >> d >> c;
		s--; d--;
		edges.insert(make_pair(c, P(s, d)));
	}
	vector<pair<ll, P>> mst_edges;
	ll mst_cost = kruskal(mst_edges);
	ll ans1 = 0, ans2 = 0;
	REP(i, mst_edges.size()) {
		edges.erase(mst_edges[i]);
		vector<pair<ll, P>> tmp;
		ll cost = kruskal(tmp);
		if(cost > mst_cost || (ll)tmp.size() < n - 1) {
			ans1++;
			ans2 += mst_edges[i].first;
		}
		edges.insert(mst_edges[i]);
	}
	cout << ans1 << " " << ans2 << endl;
 	return 0;
}

/* --------------------------------------- */




Measured memory_bytes: 6380
import sys

def solve():
    N = int(input())
    playlist = dict()
    time = [0] * (N + 1)
    for i in range(N):
        s, t = map(str, input().split())
        playlist[s] = i
        time[i + 1] = time[i] + int(t)
    w = input()

    print(time[N] - time[playlist[w] + 1])


    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>

int main(void){
	int aa=90,d,a;
	float x=0,y=0;
	while(1){
	scanf("%d,%d",&d,&a);
	if(d==0 && a==0){break;}
	y=y+(float)d*sin(aa*3.14159265358979/180);
	x=x+(float)d*cos(aa*3.14159265358979/180);
	aa=aa-a;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int out[40]={1,2,5,8};
	loop(i,4,40)out[i]=out[i-2]+(out[i-2]-out[i-4])*3;
	int n;
	while(cin>>n)cout<<out[n-1]<<endl;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>

int main () {
  int *a, i, j, k, n, key;
  
  scanf("%d", &n);
  a = (int *)malloc(sizeof(int) * n);
  
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  
  for (k = 0; k < n; k++) {
    if (k >= 1) printf(" ");
    printf("%d", a[k]);
  }
  printf("\n");
    
  for (i = 1; i < n; i++) {
    key = a[i];
    j = i - 1;
    
    while (j >= 0 && a[j] > key) {
      a[j + 1] = a[j];
      j--;
    }
    
    a[j + 1] = key;
      for (k = 0; k < n; k++) {
    if (k >= 1) printf(" ");
    printf("%d", a[k]);
  }
  printf("\n");
  }
    

  
  free(a);
  
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod=1e9+7;

int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int tsz = t.size();
    set<string> ans;

    for(int i = 0; i < n-tsz+1; i++){
        string tmp = s.substr(n-tsz-i,tsz);
        bool flag = true;
        for(int j = 0; j < tsz; j++){
            if(tmp[j] == '?') continue;
            else if(tmp[j] == t[j]) continue;
            else flag = false;
        }
        if(flag){
            string can = s;
            can.replace(n-tsz-i,tsz,t);
            for(int i = 0; i < n; i++){
                if(can[i] == '?') can[i] = 'a';
            }
            ans.insert(can);
        }
    }
    if(ans.size() == 0) cout << "UNRESTORABLE" << endl;
    for(auto p:ans){
        cout << p << endl;
        break;
    }
}

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

#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N;
   cin>>N;
   vector<int>A(N);
   for(int i=0;i<N;i++)cin>>A[i];
   sort(A.begin(),A.end());
   cout<<A[N-1]-A[0];
   return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int p=sc.nextInt();
		int q = sc.nextInt();
		int r=sc.nextInt();
		int ans=400;
		if(p+q<p+r){
			ans=p+q;
		}else{
			ans=p+r;
		}
		if(r+q<ans){
			ans=r+q;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22868
Module Program
  Sub Main
    Dim s=GetInts()
    Dim a=s(0)+s(1)
    Dim ans=(a+1)\2
    Console.WriteLine(ans)
  End Sub
  
  '/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  Function Gets() As String()
    Gets = Console.ReadLine().Split(" "c)
  End Function
  Function GetInts() As Integer()
    Dim s = Gets(), r(UBound(s)) As Integer
    For i As Integer=0 To UBound(s): r(i)=s(i): Next i
    GetInts = r
  End Function
End Module

Measured memory_bytes: 22352
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  string s, t;
  cin >> s >> t;
  cout << t + s << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 256
A, B = map(int, input().split())
rmin = B*10
rs = []
for r in range(rmin, rmin+10+1):
  if r*8//100 == A and r*10//100 == B:
    rs.append(r)
if len(rs) == 0:
  print(-1)
else:
  r = min(rs)
  print(r)


Measured memory_bytes: 3060
xy = []
xy2 = []

N = int(input())
for i in range(N):
    x, y = map(int, input().split())
    xy.append(x+y)
    xy2.append(x-y)

min_xy = min(xy)
max_xy = max(xy)
min_xy2 = min(xy2)
max_xy2 = max(xy2)

ans = max(max_xy - min_xy, min_xy2 - max_xy2, max_xy2 - min_xy2, min_xy - max_xy)
print(ans)


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

using namespace std;

const int MAXN = 1e3 + 5;
const long long INF = 1e16;

struct tow
{
	int w, s, v;
	double tr;

	bool operator<(tow other) const
	{
		return w + s < other.w + other.s;
	}
};

int n;
tow a[MAXN];
int sr, br;

void read_input()
{
	scanf("%d", &n);

	for(int i = 0; i < n; i++)
	{
		scanf("%d %d %d", &a[i].w, &a[i].s, &a[i].v);
		a[i].tr = 1.00 * a[i].w / a[i].s;
		sr = max(a[i].s, sr);
		br = max(a[i].w, br);
	}

	sort(a, a + n);
}

long long T[MAXN][MAXN * 10];

void solve()
{
	long long ans = 0;
	for(int i = 0; i <= sr + br; i++)
	{
		T[0][i] = -INF;
	}
	T[0][0] = 0;
	T[0][a[0].w] = a[0].v;
	ans = a[0].v;
	for(int i = 1; i < n; i++)
	{
		for(int j = 0; j <= sr + br; j++)
		{
			T[i][j] = T[i - 1][j];
		}
		for(int j = a[i].w; j <= sr + br; j++)
		{
			if(a[i].s >= j - a[i].w)
			T[i][j] = max(T[i][j], T[i - 1][j - a[i].w] + a[i].v);
			ans = max(ans, T[i][j]);
		}
	}
	printf("%lld\n", ans);
}

int main()
{
	read_input();
	solve();

	return 0;
}


Measured memory_bytes: 78848
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	static void Main(){
		int n=int.Parse(Console.ReadLine());
		int ans=0,o=0;
		int[] a=new int[n];
		bool[] b=new bool[30];
		for(int i=0;i<n;i++){
			a[i]=int.Parse(Console.ReadLine());
			o^=a[i];
			b[(int)Math.Log(a[i]&-a[i],2)]=true;
		}
		for(int i=29;i>=0;i--){
			if(((1<<i)&o)!=0){
				if(b[i]){o^=(1<<(i+1))-1;ans++;}
				else{ans=-1;break;}
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 17216
#include <string>
#include <iostream>
#include <cstdio>

using namespace std;

int main() {

	int n, q,i,count = 0;
	int S[10000], T[500];

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

	cin >> q;
	for (i = 0; i < q; i++) {
		cin >> T[i];
		for (int j = 0; j < n; j++) {
			if (T[i] == S[j]) {
				count++;
				break;
			}
		}
	}

	cout << count << endl;

	return 0;

}

Measured memory_bytes: 1196
N = int(input())

balls = [tuple(map(int, input().split())) for i in range(N)]
balls.sort()

pqlist = []
for i in range(len(balls)):
    for j in range(i+1, len(balls)):
        pqlist.append((balls[j][0] - balls[i][0], balls[j][1] - balls[i][1]))

saishouti = 10**9 + 7

ballset = set(balls)
for pq in pqlist:
    count = 0
    for ball in ballset:
        if (ball[0] + pq[0], ball[1] + pq[1]) in ballset:
            count += 1

    saishouti = min(saishouti, len(balls)-count)

if len(balls) == 1:
    print(1)
else:
    print(saishouti)


Measured memory_bytes: 3188
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#endif

#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


MY_NAMESPACE(sandbox)
ll gcd(ll a, ll b)
{
	if (a < b)
		swap(a, b);
	if (a % b == 0)
		return b;
	return gcd(b, a % b);
}

ll modpow(ll base, ll exponent, ll mod)
{
	ll retval = 1;
	while (exponent > 0)
	{
		if (exponent % 2)
			retval = (retval * base) % mod;
		exponent /= 2;
		base = (base * base) % mod;
	}
	return retval;
}

class HashPair
{
public:
	static size_t m_hash_pair_random;

	template<class T1, class T2>
	size_t operator()(const pair<T1, T2>& p) const {

		auto hash1 = hash<T1>{}(p.first);
		auto hash2 = hash<T2>{}(p.second);

		size_t seed = 0;
		seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
		seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
		seed ^= m_hash_pair_random + 0x9e3779b9 + (seed << 6) + (seed >> 2);
		return seed;
	}
};

size_t HashPair::m_hash_pair_random = (size_t)random_device()();

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

	ll modval = 1000000007;

	int n;
	cin >> n;
	//map<pll, int> cnt;
	unordered_map<pll, int, HashPair> cnt;
	for (int i = 0; i < n; i++)
	{
		ll a, b;
		cin >> a >> b;
		if (a != 0 && b != 0)
		{
			if (a < 0)
			{
				a *= -1;
				b *= -1;
			}
			ll g = gcd(abs(a), abs(b));
			cnt[{a / g, b / g}]++;
		}
		else if (a == 0 && b == 0)
			cnt[{0, 0}]++;
		else if (a == 0)
			cnt[{0, 1}]++;
		else  // b == 0
			cnt[{1, 0}]++;
	}

	//ll num00 = 1;
	//if (cnt[{0, 0}] == 0)
	//	num00 = 0;
	//else
	//	num00 = cnt[{0, 0}];
	ll num00 = cnt[{0, 0}];
	cnt.erase(make_pair(0,0));

	ll num = 1;
	while (!cnt.empty())
	{
		auto this_item = cnt.begin();
		pll this_pair = this_item->first;
		pll anti_pair = { this_pair.second, -this_pair.first };
		if (anti_pair.first < 0)
			anti_pair = { -this_pair.second, this_pair.first };
		else if (anti_pair.first == 0)
			anti_pair = { 0, 1 };
		if (cnt.find(anti_pair) == cnt.end())
			cnt[anti_pair] = 0;
		auto anti_item = cnt.find(anti_pair);

		num = num * (modpow(2, this_item->second, modval) - 1 + modpow(2, anti_item->second, modval) - 1 + 1) % modval;
		cnt.erase(this_item);
		cnt.erase(anti_item);
	}
	ll retval = (num00 + (num - 1) + modval) % modval;  // -1 for nothing chosen case
	cout << retval << "\n";
		
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 14660
import sys

n,y = map(int,input().split())
ans = 0

for i in range(n+1):
  for j in range(n+1):
    if 1000*(n-j-i) == y - 5000*i - 10000*j:
      if n-j-i>=0:
        ans +=1
        print(j,i,n-j-i)
        sys.exit()
 
if ans == 0:
  print("-1 -1 -1")

Measured memory_bytes: 3060
//Author: xiaowuga
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define MAX INT_MAX
#define mem(s,ch) memset(s,ch,sizeof(s))
const long long N=100000; 
const long long mod=1e9+7; 
typedef long long LL;
typedef int II;
typedef unsigned long long ull;
#define nc cout<<"nc"<<endl
#define endl "\n"
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
    II n,m,k;
    cin>>n>>m>>k;
    for(II i=0;i<=n;i++){
        for(II j=0;j<=m;j++){
            if(j*n+i*m-2*j*i==k){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
	return 0;
}



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

int main()
{
    ll x, ans;
    cin >> x;

    ans = x / 500 * 1000;
    ans += (x % 500) / 5 * 5;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define MAXN 100005
#define MP make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define SQ(a) (a)*(a)
#define nl "\n"
#define INF std::numeric_limits<int>::max()
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
ll mod=1e9+7;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	ll a[n] = {0};
	ll cmn_cnt[63] = {0};
	for(ll i = 0 ; i < n ; i++) {
		cin>>a[i];
	}
	ll ans = 0;
	for(ll i = 0; i <= 60;i++){
		ll cnt=0;
		for(int j = 0; j < n; j++){
				cnt+=(a[j]>>i)&1;
		}
		int temp =1;
		rep(j,0,i-1)temp*=2,temp%=mod;
		ans=(ans+(((temp*cnt)%mod)*(n-cnt))%mod)%mod;
	}
	cout<<ans%mod<<nl;
	return 0;
}






Measured memory_bytes: 2560