akhauriyash/Code-Regression huggingface dataset:
class dice:
    def __init__(self, X):
        self.x = [0] * 6
        self.x[0] = X[0]
        self.x[1] = X[1]
        self.x[2] = X[2]
        self.x[3] = X[3]
        self.x[4] = X[4]
        self.x[5] = X[5]

    def roll(self, d):
        if d == 'S':
            self.x[0], self.x[1], self.x[4], self.x[5] = \
            self.x[4], self.x[0], self.x[5], self.x[1]
        elif d == 'E':
            self.x[0], self.x[2], self.x[3], self.x[5] = \
            self.x[3], self.x[0], self.x[5], self.x[2]
        elif d == 'W':
            self.x[0], self.x[2], self.x[3], self.x[5] = \
            self.x[2], self.x[5], self.x[0], self.x[3]
        elif d == 'N':
            self.x[0], self.x[1], self.x[4], self.x[5] = \
            self.x[1], self.x[5], self.x[0], self.x[4]

n = int(input())
X = list(map(int, input().split()))
dice_b = dice(X)
distances = list('NNNNWNNNWNNNENNNENNNWNNN')
b = False
for _ in range(n-1):
    X_t = list(map(int, input().split()))
    dice_t = dice(X_t)
    for d in distances:
        dice_t.roll(d)
        if dice_b.x[0] == dice_t.x[0] and dice_b.x[1] == dice_t.x[1] and dice_b.x[2] == dice_t.x[2] and \
            dice_b.x[3] == dice_t.x[3] and dice_b.x[4] == dice_t.x[4] and dice_b.x[5] == dice_t.x[5]:
            b = True
            break
if b == False:
    print('Yes')
elif b == True:
    print('No')


Measured memory_bytes: 5620
# coding: utf-8
# Your code here!

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

n=int(input())

A=[105,135,165,189,195]

c=0
for i in A:
    if n<i:
        break
    else:
        c+=1
print(c)

#if :
#    print("Yes")
#else:
#    print("No")

Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    string s; cin>>s;
    int n=s.size();

    int ans=0;
    for(int i=0; i<n; i++){
        int sum=0;
        for(int j=i; j<n; j++){
            if(s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T') sum++;
            else break;
        }

        chmax(ans, sum);
    }

    cout << ans << endl;
}

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

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int result = (a + b) * (h / 2);

        System.out.println(result);
    }


    /// self liblary
    public static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

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

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

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

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

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

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

}


Measured memory_bytes: 7892
import math
import sys
from operator import itemgetter

# N, K = map(int, input().split())
# h = list(map(int, input().split()))
# S = [input() for _ in range(H)]
# X = [[0 for j in range(100)] for i in range(200)]


### input
a = list(range(0))
a.append(int(input()))

## solve
ans = 0
while(ans == 0):
	p = 0
	if (a[-1] == 1):
		p = 4
	elif (a[-1] % 2 == 0):
		p = a[-1]//2
	else:
		p = a[-1]*3+1
	
	if (p in a):
		ans = len(a)+1
	else:
		a.append(p)

print(ans)


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

int main()
{
    string N;
    cin >> N;
    for (char i: N)
    {
        if (i == '7')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<functional>
#include<bits/stdc++.h>
#include<map>
#include<utility>

#define vec2c vector<vector<char>>
#define vec2i vector<vector<int>>
#define vecc vector<char>
#define vecs vector<string>
#define veci vector<int>
#define vecd vector<double>
#define vecl vector<long>
#define vecll vector<long long>
#define rep(i, n) for(int i=0; i < (int)(n); i++)
#define rrep(i, n) for(int i=(int)(n); i>=0;i--)
#define rep1e(i, n) for(int i=1; i <= (int)(n); i++)
#define rep1ne(i, n) for(int i=1; i < (int)(n); i++)

#define MAX 100010

using namespace std;

unsigned digit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {

	int N;
	cin >> N;
	veci A,B,C;
	rep(i, N) {
		int a;
		cin >> a;
		A.push_back(a);
	}
	rep(i, N) {
		int b;
		cin >> b;
		B.push_back(b);
	}
	rep(i, N-1) {
		int c;
		cin >> c;
		C.push_back(c);
	}

	int ans = 0;
	int bef = -99999;
	rep(i, N) {
		ans += B[A[i] - 1];
		if (bef == A[i] - 2) {
			ans += C[bef];
		}
		bef = A[i] - 1;
	}
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

bool judge(long long mid, long long K, vector<long long> &A, vector<long long> &F){
    long long cnt=0;
    for(int i=0; i<(int) F.size(); i++){
        cnt += max((long long) 0, A[i]-mid/F[i]);
        if(cnt>K){
            return false;
        }
    }
    return true;
}

long long bin_search(long long  l, long long r, long long K, vector<long long> &A, vector<long long> &F){
    long long mid=(l+r)/2+((l+r)%2==1);
    if(r==mid){
        return mid;
    }

    if(judge(mid, K, A, F)){
        return bin_search(l, mid, K, A, F);
    }else{
        return bin_search(mid, r, K, A, F);
    }
}

int main(){
    long long N, K;
    cin >> N >> K;
    vector<long long> A(N,0);
    vector<long long> F(N,0);

    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    for(int i=0; i<N; i++){
        cin >> F[i];
    }

    sort(A.begin(), A.end());
    sort(F.rbegin(), F.rend());
    long long max_=0;
    for(int i=0; i<N; i++){
        max_=max(max_,A[i]*F[i]);
    }

    long long ans = bin_search(-1, max_, K, A, F);
    cout << ans << endl;
}

Measured memory_bytes: 3328
// 6

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1ll<<29;
const bool debug = 0;

int N;
pii conv[4][5] = {
	{ {1,24}, {4,27}, {7,30}, {21,10}, {16,18} },
	{ {3,22}, {6,25}, {9,28}, {19,12}, {15,13} },
	{ {1,28}, {2,29}, {3,30}, {16,15}, {21,19} },
	{ {7,22}, {8,23}, {9,24}, {18,13}, {10,12} }
};

int main() {
	REP(i, 4) REP(j, 5) {
		conv[i][j].fi--;
		conv[i][j].se--;
	}
	cin >> N;
	
	int tmp[30] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 6, 6, 6, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3};
	vector<int> ansv(tmp, tmp + 30);
	
	while (N--) {
		vector<int> p(30);
		REP(i, 30) scanf("%d", &p[i]);
		
		if (p == ansv) {
			cout << 0 << endl;
			continue;
		}
		
		queue<pair<vector<int>, int> > que;
		que.push(make_pair(p, 0));
		int ans = -1;
		
		while (!que.empty()) {
			vector<int> now = que.front().fi;
			int cnt = que.front().se;
			que.pop();
			
			REP(i, 4) {
				vector<int> nex = now;
				REP(j, 5) swap(nex[conv[i][j].fi], nex[conv[i][j].se]);
				if (nex == ansv) {
					ans = cnt + 1;
					break;
				}
				que.push(make_pair(nex, cnt + 1));
			}
			
			if (ans != -1) break;
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 6492
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

// long long ? ?
int32_t main(){
  fastio;
  int a,b;
  cin>>a>>b;
  int g = gcd(a,b);
  set<int> S;
  S.insert(1);
  for(int i=2;i*i<=g;i++){
    if(g%i==0){
        while(g%i==0)g/=i;
        S.insert(i);
    }
  }
  if(g>1)S.insert(g);
  cout<<S.size()<<endl;

  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().rstrip().split(" ")))
k = [0 for i in range(N + 1)]
ans = 0
for i in range(N):
    k[i + 1] = k[i] + A[i]
for i in range(N):
    ans += k[i] * A[i]
    ans %= 10 ** 9 + 7
print(ans)

Measured memory_bytes: 106244
main()
{
	int a,b,c,d=1,e=1,i,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		a=i%2;
		c=i;b=0;
		while(a==0)
		{
			c=c/2;a=c%2;b+=1;
		}
		if(b>=d)
		{
			d=b;e=i;
		}
	}
	printf("%d\n",e);
}

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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

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

    return gcd(b, a%b);
}

const ll L = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll A, B, C;
    cin >> A >> B >> C;


    cout << min(C, max(0LL, C-A+B)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){

  int i,j,k,H,W;

  while (1){
    
    scanf("%d %d",&H,&W);
      
    if (H != 0 && W != 0){
      
      for (k = 0; k < H/2; k++){ 
	
	for (i = 0; i < W/2; i++){
	  
	  printf("#.");
	  
	}
	
	if (W%2 == 1){
	  
	  printf("#");
	  
	}
	
	printf("\n");
	
	for (j = 0; j < W/2; j++){
	  
	  printf(".#");
	  
	}
	
	if (W%2 == 1){
	  
	  printf(".");
	  
	}

	printf("\n");
	
      }
      
      if (H%2 == 1){
	
	for (i = 0; i < W/2; i++){
	  
	  printf("#.");
	  
	}
	
	if (W%2 == 1){
	  
	  printf("#");
	  
	}

	printf("\n");
	
      }

      printf("\n");
      
    } else {
      
      break;
      
    }
    

  }
  
  return 0;
    
}

Measured memory_bytes: 588
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }

            boolean isValid = true;
            for (int i = 0; i < N; i++) {
                if (A[i] % 2 == 1) {
                    continue;
                }
                if (!(A[i] % 3 == 0 || A[i] % 5 == 0)) {
                    isValid = false;
                }
            }

            System.out.println(isValid ? "APPROVED" : "DENIED");
        }
    }
}

Measured memory_bytes: 26924
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    string s,t;cin>>s>>t;
    vector<char> v1,v2;
    REP(i,SIZE(s))v1.push_back(s[i]);
    REP(i,SIZE(t))v2.push_back(t[i]);
    sort(ALL(v1));
    sort(v2.begin(), v2.end(), greater<>());
    string s1,t1;
    REP(i,SIZE(v1))s1+=v1[i];
    REP(i,SIZE(v2))t1+=v2[i];
    if(s1<t1){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

void solve(int N, vector<int> H)
{
    int res = 0, tmp = 0;
    int h = H.at(0);
    for (int i = 1; i < N; i++)
    {
        if (H.at(i) <= h)
        {
            tmp++;
            res = max(res, tmp);
        }
        else
        {
            tmp = 0;
        }
        h = H.at(i);
    }
    cout << res << endl;
}

int main()
{
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++)
    {
        cin >> H.at(i);
    }
    solve(N, move(H));
    return 0;
}


Measured memory_bytes: 3784
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<list>
using namespace std;

int main() {

	string N;
	cin >> N;

	if (N[N.length() - 1] == '3') {
		cout << "bon" << endl;
	}
	else if (N[N.length() - 1] == '0' || N[N.length() - 1] == '1' || N[N.length() - 1] == '6' || N[N.length() - 1] == '8') {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    int N, A, B;

    cin >> N >> A >> B;

    int sum = 0;

    for(int i = 1; i <= N; i++){
        int w = 0;
        int j = i;

       while(j > 0){
            w += j%10;
            j = j/10;
        }

        if(w >= A && w <= B){
            sum += i;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  char c;
  cin>>c;

  cout<<char(c+1)<<endl;

  return 0;
}


Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const a = Number(input.split(' ')[0]);

const b = Number(input.split(' ')[1]);

const output = () => {
  if (a > 8 || b > 8) {
    console.log(':(');
  } else {
    console.log('Yay!');
  }
}

output();


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define pb push_back
#define fs first
#define sc second
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const double EPS = 1e-9;

int main() {
    cin.sync_with_stdio(false);
    int k;
    cin >> k;
    rep(i,0,k) {
        cout << "ACL";
    }
    cout << endl;
}




Measured memory_bytes: 3640
// C - Sugar Water
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

void solve(int w1,int w2, int s1, int s2, int solute, int
volume){
	int WS = w1*100, S = 0;
	int wend = volume/100 + 1;
	double maxper = 0.0;
	rp(iw, 1, wend){
		rp(jw, 0, wend){
			int w = w1*iw + w2*jw;
			if(0 < w && w < wend){
				int send = volume - w*100 + 1;
				rp(is, 0, send){
					rp(js, 0, send){
						int s = s1*is + s2*js;
						if(s < send){

							int maxsol = solute * w;
							int ws = w * 100 + s;
							if(ws <= volume && s <= maxsol){
								double per = 100.0*s/ws;
								if(maxper < per){
									maxper = per;
									WS = ws;
									S = s;
								}
							}

						}
					}
				}
			}
		}
	}
	printf("%d %d\n",WS,S);
}

int main(){
	int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f;
	solve(a,b,c,d,e,f);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define pb push_back

///Input/Output macros!
#define gi(x) scanf("%d", &x)
#define gi2(x, y) scanf("%d%d", &x, &y)
#define gi3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define gill(x) scanf("%lld", &x)
#define gill2(x, y) scanf("%lld%lld", &x, &y)
#define gill3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pill(x) printf("%lld\n", x)


///Basic Debugging macros!
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(ll __i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(ll __i__=0;__i__<r;__i__++){for(ll __j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}

using namespace std;

///Power of 2 till 2^31!
ll pow2[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648};

///Power function!
ll power(ll x,ll y)
{
        ll res = 1;
        while(y>0){
            if(y&1)
                res *= x;
            y>>=1;
            x*=x;
        }
        return res;
}

///Basic Sieve of Eratosthenes!
void Sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (ll p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

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

bool isPerfectSquare(ll x){ ll s = sqrt(x); return (s*s == x);}

bool isFibonacci(int n){return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);}

bool isPrime(int n){if (n <= 1)return false;if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0)return false;
    return true;
}

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;


const int MOD = 1000000007;
const long double PI = 4*atan((long double)1);
const ll INF = 1e18;



int main()
{
    ll a,b,x;
    scanf("%lld%lld%lld",&a,&b,&x);
    ll vol = a*a*b;
    if(x<vol/2){
        double d = (a*b*b)/(2.0*x);
        //cout<<d<<' ';
        double ans = (atan(d)*180)/3.14159265;
        cout<<fixed<<setprecision(10)<<ans<<'\n';//cout<<ans<<'\n';
    }
    else{
        x = vol-x;
        double d = (2*x)/(double)(a*a*a);
        double ans = (atan(d)*180)/3.14159265;
        cout<<fixed<<setprecision(10)<<ans<<'\n';
    }
}


Measured memory_bytes: 384
// A - Christmas Eve Eve Eve
// https://atcoder.jp/contests/abc115/tasks/abc115_a
// +build ignore

package main

import "fmt"

func main() {
	var d int
	fmt.Scan(&d)
	switch d {
	case 25:
		fmt.Println("Christmas")
	case 24:
		fmt.Println("Christmas Eve")
	case 23:
		fmt.Println("Christmas Eve Eve")
	case 22:
		fmt.Println("Christmas Eve Eve Eve")
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 29;
 
int main() {
	string s;
	cin >> s;
	int l = s.size();
	int cnt = 1;
	int i = 1;
	bool two = false;
	while (true)
	{
		if (i > l-1) break;
		if (s[i-1]!=s[i] || two) {
			cnt++;
			i++;
			two = false; continue;
		}
		else if (i != l-1){
			cnt++;
			i += 2;
			two = true; continue;
		}
		i++;
	}
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 640
'''
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def bitlist(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res
'''
#a = list(map(int, input().split()))
'''
n,m,t = list(map(int, input().split()))

nb = [[] for i in range(n+1)]
for i in range(n):
    a,b = list(map(int, input().split()))
    nb[a].append([b,i])
    nb[b].append([a,i])
print(nb)

order = [-1 for i in range(n+1)]
order[1] = 0
noworder = 1
nbnow = [len(nb[i])-1 for i in range(n+1)]

print(nbnow)
queue = [[1,999999]]
deque = 0

while(len(queue)>deque and len(queue)<20):
    nownum = queue[deque][0]
    nowpos = queue[deque][1]
    deque+=1
    print("a",nownum,nowpos)
    while(True):
        if(nb[nownum][nbnow[nownum]][1] > nowpos):
            nbnow[nownum] -= 1
        if(nbnow[nownum]<=-1):
            break
    if(nbnow[nownum]<=-1):
        continue
    
    nextnum = nb[nownum][nbnow[nownum]][0]
    nextpos = nb[nownum][nbnow[nownum]][1]
    print(nextnum,nextpos)
    if(order[nextnum]==-1):
        queue.append([nextnum,nextpos])
        order[nextnum]=noworder
        noworder+=1


print(order)
'''

#a = list(map(str, input().split()))

a = list(map(str,input().split()))

print(a[1]+a[0])

Measured memory_bytes: 38384
import sys
input = sys.stdin.readline


def read():
    A, B, C, K = map(int, input().strip().split())
    return A, B, C, K


def swap(a, b, c):
    return b+c, c+a, a+b


def solve(A, B, C, K):
    a, b, c = A, B, C
    s = (A + B + C) * (K // 2)
    a += s
    b += s
    c += s
    if K % 2 == 1:
        a, b, c = swap(a, b, c)
    return a - b


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


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

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

ll sum(int *first, int *last) {
  ll result=0, i=0;
  while(first+i < last) {
    result += *(first+i);
    i++;
  }
  return result;
}

int main(void) {
  int n;
  cin >> n;

  int a[n];
  rep(i, n) cin >> a[i];

  sort(a, a+n);
  printf("%d %d %ld\n", a[0], a[n-1], sum(a, a+n));
}



Measured memory_bytes: 3256
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double x1 = sc.nextDouble();
        double y1 = sc.nextDouble();
        double x2 = sc.nextDouble();
        double y2 = sc.nextDouble();
        
        System.out.println(Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)));
    }
}


Measured memory_bytes: 28016
n, m = map(int, input().split())


flag = []
ball = []

for i in range(n):
    flag.append(False)
    ball.append(1)

flag[0] = True

for i in range(m):
    x, y = map(int, input().split())
    x-=1
    y-=1

    ball[y] += 1
    ball[x] -= 1
    flag[y] |= flag[x]

    if ball[x] == 0:
        flag[x] = False
    
ans = 0

for i in range(n):
    ans += flag[i]

print(ans)

    


Measured memory_bytes: 4712
import java.util.*;
import java.sql.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<Integer, Integer> map = new HashMap<>();
		
		while (sc.hasNextInt()) {
			int key = sc.nextInt();
			if (map.containsKey(key)) {
				map.put(key, map.get(key) + 1);
			} else {
				map.put(key, 1);
			}
		}
		
		
		
		int ans = 0;
		
		for (int key : map.keySet()) {
			int count = map.get(key);
			if (key < count) {
				ans += count - key;
			} else if (key > count) {
				ans += count;
			}
		}
		System.out.println(ans);
	}
}

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

using namespace std;

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

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

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   char s[13];
   rep(i,4)cin >> s[i];
   s[4] = ' ';
   for(int i=5;i<13;i++)cin >> s[i];
   cout << s << endl;
   return 0;
}

Measured memory_bytes: 256
k = gets.to_i
if k % 2 == 0 || k % 5 == 0
  puts "-1"
  exit
end

res = 1
d = 7
cur = d
loop do
  if cur % k == 0
    break
  end
  d *= 10
  d %= k
  cur += d
  res += 1
end
puts res

Measured memory_bytes: 14384
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>

int main() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	int a = int(s[k -1]);
	a += 32;
	s[k -1] = char(a);
	cout << s;
	return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = 1001001001;
    for(int i = -100; i <= 100; i++){
        int tmp = 0;
        rep(j,n) tmp += (a[j] - i) * (a[j] - i);
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
using static System.Math;
using static System.Console;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Net;
using System.Dynamic;

class Program {
    static void Main(string[] args) {
        var a = ReadLine();
        var c = a.ToCharArray().Distinct();
        WriteLine(c.Count() == 3 ? "Yes" : "No");
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define RI register int
typedef long long LL;
int n;LL X,ans,a[2005],mi[2005][2005];
int main()
{
	scanf("%d%lld",&n,&X);
	for(RI i=1;i<=n;++i) scanf("%lld",&a[i]);
	for(RI i=1;i<=n;++i) {
		mi[i][i]=a[i];
		for(RI j=i+1;j<=n;++j) mi[i][j]=min(mi[i][j-1],a[j]);
	}
	for(RI i=0;i<n;++i) {
		LL kl=1LL*i*X;
		for(RI j=1;j<=n;++j) {
			int t=j-i;
			if(t>=1) kl+=mi[t][j];
			else kl+=min(mi[1][j],mi[t+n][n]);
		}
		if(i==0||kl<ans) ans=kl;
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main(){

    int A,B,N,M,H,W;
    int i,j,k;
    int min = 1000000000;
    int max = 0;
    int a,b,c,d;
    int count=0,count_two=0,v;
    string moji[50];
    
    cin >> H >> W;

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

    for(i=0;i<H;i++)cin >> moji[i];

    for(i=0;i<H;i++){
        for(j=0;j<W;j++){
            if(moji[i][j] == '#'){
                cout << "#";
                continue;
            }
            else{
                for(k=0;k<8;k++){
                    if(i+dx[k] < 0 || i+dx[k] > H-1 || j+dy[k] < 0 || j+dy[k] > W-1 )continue;
                    if(moji[i+dx[k]][j+dy[k]] == '#')count ++; 
                }
                cout << count;
                count = 0;
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
//ΔAPC001H
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 2222;
int n,a[N],f[N],d[N],t[N],r[N],b[N],e[N],h[N],s[N],w[N];
vector<int> v;
int chk(){
	int i;
	for(i=1;i<=n;i=i+1)
		if(a[i]!=i)
			return 1;
	return 0;
}
int main()
{
	//srand(8996);
	int i,j;
	//n=2000;
	cin>>n;
	for(i=1;i<=n;i=i+1){
		if(i>1)
			scanf("%d",f+i),f[i]++;
		else
			f[i]=0;
		/*if(i>1)
			f[i]=i/2;*/
		d[i]=d[f[i]]+1;
		t[i]=1;
		r[i]=0;
		b[i]=i;
	}
	for(i=n;i;i=i-1){
		t[f[i]]+=t[i];
		if(t[r[f[i]]]<t[i])
			r[f[i]]=i;
	}
	for(i=1;i<=n;i=i+1)
		if(r[i])
			b[r[i]]=b[i];
	for(i=1;i<=n;i=i+1)
		scanf("%d",a+i),a[i]++;
	//random_shuffle(a+1,a+n+1);
	while(chk()){
		for(i=1;i<=n;i=i+1)
			e[i]=(a[i]==i);
		for(i=n;i;i=i-1)
			e[f[i]]&=e[i];
		for(i=1;i<=n;i=i+1)
			h[i]=(b[a[i]]==b[i]&&a[i]<=i);
		for(i=n;i;i=i-1){
			h[f[i]]&=h[i];
			if(a[f[i]]>a[i])
				h[f[i]]=0;
		}
		for(i=1;i<=n;i=i+1)
			w[i]=!e[i],w[f[i]]&=h[i];
		for(i=1;i<=n;i=i+1)
			s[i]=0;
		s[a[1]]=1;
		for(i=1;i<=n;i=i+1)
			s[i]|=s[f[i]];
		j=0;
		for(i=1;i<=n;i=i+1){
			if(s[i]&&w[i])
				if(!r[i]||a[1]<a[r[i]])
					if(!h[i]||a[i]<a[1])
						if(!j||a[j]<a[i])
							j=i;
		}
		v.push_back(j);
		//cout<<j<<endl;
		for(i=j,j=a[1];i;i=f[i])
			swap(a[i],j);
		//for(i=1;i<=n;i=i+1)
		//	cout<<h[i];
		//cout<<endl;
	}
	j=v.size();
	cout<<j<<endl;
	//return 0;
	for(i=0;i<j;i=i+1)
		cout<<v[i]-1<<endl;
	return 0;
}

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

const ll bd = pow(10,18);

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  int flg = 0;
  rep(i,0,n){
    cin >> a[i];
    if(a[i]==0) flg = 1;
  }
  if(flg){
    cout << 0 << endl;
    return 0;
  }
  ll prod = 1;
  rep(i,0,n){
    if(prod>bd/a[i]){
      cout << -1 << endl;
      return 0;
    }
    prod *= a[i];
    if(prod>bd){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << prod << endl;
  return 0;
}

Measured memory_bytes: 3996
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

const int MAX_N = 1002;
const int MAX_W = 10001;
const int MAX_V = 10001;

int dp[MAX_N][MAX_W];
int w[MAX_N];
int v[MAX_N];

int N,W;

int main(){
  int c = 1;
  while(cin >> W , W){
    cin >> N;
    for(int i=0; i<N; i++){
      scanf("%d,%d", &v[i], &w[i]);
    }
    memset(dp,0,sizeof(dp));

    for(int i=0; i<N; i++){
      for(int j=0; j<=W; j++){
        if(j >= w[i]){
          dp[i+1][j] = max(dp[i][j] , dp[i][j-w[i]]+v[i]);
        }
        else dp[i+1][j] = dp[i][j];
      }
    }
    
    int weight=1000000;
    for(int i=0; i<=N; i++){
      for(int j=0; j<=W; j++){
        if(dp[i][j] == dp[N][W]){
          weight = min(weight,j);
        }
      }
    }
  out:;
    printf("Case %d:\n%d\n%d\n", c++, dp[N][W], weight);
  }

  return 0;
}

Measured memory_bytes: 40388
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,a,b,k,i;
	scanf("%d %d %d",&a,&b,&k);
	l=b-a+1;
	if(l>=2*k)
	{
		for(i=a;i<=a+k-1;i++)
		{
			printf("%d\n",i);
		}
		for(i=b-k+1;i<=b;i++)
		{
			printf("%d\n",i);
		}
	}
	else
	{
		for(i=a;i<=b;i++)
		{
			printf("%d\n",i);
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main ()
{
   
    int a,b,i,s=0;
    scanf("%d %d",&a,&b);
    int x[b];
    for(i=0;i<b;i++)
    {
        scanf("%d",&x[i]);
        s=s+x[i];
    }
    if(s>a) printf("%d\n",-1);
    else printf("%d\n",a-s);

    return 0;
}


Measured memory_bytes: 1748
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    surplus_scores = []
    sum_lack_score = 0
    ans = 0
    for a, b in zip(A, B):
        if a > b:
            surplus_scores.append(a - b)
        elif a < b:
            sum_lack_score += b - a
            ans += 1

    surplus_scores.sort(reverse=True)
    if sum_lack_score > 0:
        pass_exam = False
        for score in surplus_scores:
            sum_lack_score -= score
            ans += 1
            if sum_lack_score <= 0:
                pass_exam = True
                break
        if not pass_exam:
            ans = -1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 18652
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int A[100000 + 10];
pi cnt[45]; //cnt[i]:2^iの桁の0の数(fi)と1の数(se)
int p_2[45];

signed main(void) {
    int N, K; cin >> N >> K;
    p_2[0] = 1;
    REP(i, 1, 40) {
        p_2[i] = p_2[i-1] * 2;
    }
    rep(i, N) {
        cin >> A[i];
        int d = A[i];
        int k = 40;
        while(k >= 0) {
            // cout << "k:" << k << endl;
            // cout << "p_2[k]:" << p_2[k] << endl;
            // cout << "d:" << d << endl;
            if (d >= p_2[k]) {
                d -= p_2[k];
                cnt[k].se++;
            } else {
                cnt[k].fi++;
            }
            k--;
        }
    }
    int arg = 0;
    for(int i=40; i>=0; i--) {
        // cout << "cnt[" << i << "]:(" << cnt[i].fi << ", " << cnt[i].se << ")" << endl;
        if (cnt[i].fi >= cnt[i].se) { //0の方が多い
            if (K >= p_2[i]) { //入れられるなら
                arg += p_2[i];
                K -= p_2[i];
            }
        }
    }
    // cout << arg << endl;
    int ans = 0;
    rep(i, N) {
        ans += arg ^ A[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        n: u64,
    }

    let f = prime_factorize(n);
    let mut ans = 0;

    for (_, i) in f {
        let mut j = i;
        for k in 1..=i {
            if k <= j {
                ans += 1;
                j -= k;
            } else {
                break;
            }
        }
    }

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

fn prime_factorize(n: u64) -> Vec<(u64, u64)> {
    let mut n = n;
    let mut res = vec![];
    let mut a = 2;

    while a * a <= n {
        if n % a != 0 {
            a += 1;
            continue;
        }

        let mut count = 0;
        while n % a == 0 {
            count += 1;
            n /= a;
        }

        res.push((a, count));
        a += 1;
    }

    if n != 1 {
        res.push((n, 1));
    }

    res
}


Measured memory_bytes: 2116
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a, b, tot = 1;//至少包含1 
	cin >> a >> b;
	for(long long i = 2; i<=a/i && i<=b/i; i++)
	{
		if(a%i==0 && b%i==0) tot++;
		while(a%i==0) a/=i;
		while(b%i==0) b/=i;
	}
	if(a!=1 && b!=1 && (a%b==0||b%a==0)) tot++;
	cout << tot << endl;
	
	return 0;
}

Measured memory_bytes: 256
//#define NDEBUG

#include <bits/stdc++.h>
#include <bits/extc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) (((a) + (b) - 1) / (b))
#define tomax(a, b) ((a) = max((a), (b)))
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}

//#define TEST

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tiii = tuple<int, int, int>;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}

vector<ll> thr(100001);

ll three(ll n){
    if(n < 0) return 0;
    return thr[n];
}

int main(){
    StarBurstStream

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

    thr[0] = 1;
    for(int i = 1; i <= 100000; i++) thr[i] = thr[i - 1] * 3 % MOD;

    int Q = 0;
    for(char i : s) Q += (i == '?');

    ll ans = 0;
    ll a = 0, ab = 0;
    ll q = 0;
    ll qb = 0, aq = 0;
    ll qq = 0;
    for(int i = 0; i < n; i++){
//        cerr << i << " " << s[i] << " " << a << " " << ab << " " << q << " " << qb << " " << aq << " " << qq << "\n";
        if(s[i] == 'A'){
            a++;
            a %= MOD;
        }
        else if(s[i] == 'B'){
            ab += a;
            qb += q;
            ab %= MOD;
            qb %= MOD;
        }
        else if(s[i] == 'C'){
            ans += ab * three(Q) % MOD;
            ans += aq * three(Q - 1) % MOD;
            ans += qb * three(Q - 1) % MOD;
            ans += qq * three(Q - 2) % MOD;
            ans %= MOD;
        }
        else{
            ans += ab * three(Q - 1) % MOD;
            ans += qb * three(Q - 2) % MOD;
            ans += aq * three(Q - 2) % MOD;
            ans += qq * three(Q - 3) % MOD;
            ans %= MOD;
            aq += a;
            qq += q;
            q++;
            aq %= MOD;
            qq %= MOD;
            q %= MOD;
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

const int MAX_N = 100000;
int N, M;

vector<pair<int, int> > ab_pairs;

void solve() {
    // bの昇順にならべかえる
    sort(ab_pairs.begin(), ab_pairs.end());

    int before_removed = 0;
    int sum = 0;
    int a, b;
    for (int i = 0; i < M; i++) {
        a = ab_pairs[i].second, b = ab_pairs[i].first;
        if (before_removed >= a && before_removed < b) {
            continue;
        }
        before_removed = b - 1;
        sum++;
    }

    printf("%d\n", sum);
}

int main() {
    cin >> N >> M;
    int a, b;
    for (int i = 0; i < M; i++) {
        cin >> a >> b;
        ab_pairs.push_back(make_pair(b, a));
    }
    solve();
}


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

#define tezi ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define endl "\n"
#define int long long
#define pii pair<int, int>
#define piii pair<int, pair<int, int>>
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define deb(x) cout << #x << " = " << x << endl
#define all(x) x.begin(), x.end()
#define MAX 1000000000000000001
#define MAXN 1000001
#define mod 1000000007
#define PI 3.1415926535897932384626

int mod_exp(int x, int y);

//ofstream fout("file.out");
//ifstream fin("file.in");

vector<int> spf(MAXN);

void sieve(){
    spf[1] = 1;
    for(int i = 2; i < MAXN; ++i){
        spf[i] = i;
    }
    for(int i = 4; i < MAXN; i += 2){
        spf[i] = 2;
    }
    for(int i = 3; i * i < MAXN; ++i){
        if(spf[i] != i) continue;
        for(int j = i * i; j < MAXN; j += i){
            if(spf[j] == j) spf[j] = i;
        }
    }
}

void solve(){
    sieve();
    int n, ans = 0;
    cin >> n;
    vector<int> a(n);
    map<int, int> m;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        m[a[i]]++;
    }
    for(int i = 0; i < n; ++i){
        int flag = 0;
        for(int j = 1; j * j <= a[i]; ++j){
            if(a[i] % j != 0) continue;
            int n1 = j, n2 = a[i] / j;
            if(n1 == a[i]){
                if(m[n1] > 1){
                    flag = 1;
                    break;
                }
            }
            else{
                if(m.find(n1) != m.end()){
                    flag = 1;
                    break;
                }
            }
            if(n2 == a[i]){
                if(m[n2] > 1){
                    flag = 1;
                    break;
                }
            }
            else{
                if(m.find(n2) != m.end()){
                    flag = 1;
                    break;
                }
            }
        }
        if(flag == 0) ans++;
    }
    cout << ans << endl;
}

int32_t main(){
    tezi;
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

int mod_exp(int x, int y){
    y %= mod;
    int res = 1;
    while(y > 0){
        if(y % 2 != 0) res = (res * x) % mod;
        x = (x * x) % mod;
        y /= 2;
    }
    return res;
}


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

namespace ABC143D_Triangles
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] l = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Array.Sort(l);

            int count = 0;
            for (int a = 0; a < n - 2; a++)
            {
                for (int b = a + 1; b < n - 1; b++)
                {
                    //for (int c = b + 1; c < n; c++)
                    //{
                    //    if (l[c] < l[a] + l[b])
                    //    {
                    //        count++;
                    //    }
                    //    else
                    //    {
                    //        break;
                    //    }
                    //}

                    for (int c = n-1; b+1 <= n; c--)
                    {
                        if (l[c] < l[a] + l[b])
                        {
                            count += c - (b + 1) + 1;
                            break;
                        }
                    }
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13292
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>

int main() {
   
   int N, T, A;
   std::cin >> N >> T >> A;

   int H[N];
   double H2[N];
   double ABS[N];
   for (int i = 0; i < N; i++) {
      std::cin >> H[i];
      H2[i] = T - H[i] * 0.006;
      ABS[i] = std::abs(H2[i]-A);
   }
   double ans;
   int id;
   for (int i = 0; i < N; i++) {
      if (i == 0) {
         ans = ABS[i];
         id = i;
      }
      else{
         if (ans >ABS[i]) {
            ans = ABS[i];
            id = i;
         }
      }
   }
   std::cout << id + 1 << std::endl;

   return 0;
}


Measured memory_bytes: 256
import Data.List

ans c@(c1:c2:c3:_) =
  let r = [1..10] \\ c
      a = filter (\x -> x+c1+c2 <= 20) r
  in
    if (length a) >= 4
    then "YES"
    else "NO"

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = map ans i
  mapM_ putStrLn o

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int n;
    cin >> n;
    string s[n];
    int t[n];
    rep(i, n){
        cin >> s[i] >> t[i];
    }
    string x;
    cin >> x;

    bool add = false;

    int ans = 0;
    rep(i, n){
        if(add) ans += t[i];
        if(s[i]==x) add = true;
    }
    
    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

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

using ll = long long;

int main() {
    int N;  cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    sort(A.begin(), A.end(), greater<ll>());

    ll ans = 0, cnt = 0;
    for (int i = 0; i < N; ++i) {
        if (i == 0) {
            ans += A[i];
            cnt += 1;
        }
        else {
            ans += 2 * A[i];
            cnt += 2;
        }

        if (cnt == N - 1) break;
        if (cnt > N - 1) {
            ans -= A[i];
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 4808
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  const int n = getInt();
  const int m = getInt();
  vector<vector<int> > childs(n);
  vector<int> in(n);
  vector<int> depth(n);

  REP(i,n+m-1){
    const int a = getInt() - 1;
    const int b = getInt() - 1;
    childs[a].push_back(b);
    in[b]++;
  }
  queue<int> q;
  REP(i,n) if(in[i] == 0) q.push(i);
  while(q.size()){
    const int p = q.front(); q.pop();

    for(int c : childs[p]){
      if(--in[c] == 0){
        q.push(c);
      }
      depth[c] = max(depth[c], depth[p] + 1);
    }
  }

  vector<int> parent(n);
  REP(i,n){
    for(int c : childs[i]){
      if(depth[c] == depth[i] + 1){
        parent[c] = i + 1;
      }
    }
  }

  REP(i,n){
    printf("%d\n", parent[i]);
  }

  return 0;
}

Measured memory_bytes: 7424
#include <stdio.h>

int abs(int n)
{
    return n>0?n:-n;
}

int gcd(int a,int b)
{
    if(a>b)
    {
        if(b==0) return a;
        else return gcd(a%b,b);
    }
    else
    {
        if(a==0) return b;
        else return gcd(b%a,a);
    }
}

int main()
{
    int n,x;
    scanf("%d %d",&n,&x);
    int y[100000];
    for(int i=0;i<n;i++) scanf("%d",&y[i]);

    for(int i=0;i<n;i++) y[i]=abs(y[i]-x);

    int ans=y[0];
    for(int i=1;i<n;i++)
    {
        ans=gcd(ans,y[i]);
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 512