akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

int n,m;
string s;
vector<int>path;
vector<int>vis(100000+5);
void dfs(int n){
	if( vis[n] )return;
	vis[n]=1;
	if( n == 0){
		reverse(path.begin(),path.end());
		for(auto p:path){
			cout << p << " " ;
		}
		exit(0);
	}
	for(int k = min(n,m) ; k >= 1 ; k-- ){
		if( s[ n - k ] == '0' ){
			path.push_back(k);
			dfs(n-k);
			path.pop_back();
		}
	}
}
int32_t main(){
	IOS
	cin >> n >> m >> s;
	dfs(n);
	cout << -1 << endl;
 }
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 9884
fn main() {
    let mut buf = String::new();

    std::io::stdin().read_line(&mut buf).unwrap();

    let mut iter = buf.trim().split_whitespace();

    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();

    let mut array = [a, b, c];
    array.sort();

    println!("{} {} {}", array[0], array[1], array[2] );
}


Measured memory_bytes: 5024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[3];
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                int p = 0;
                while (x % 2 == 0) {
                    ++p;
                    x /= 2;
                }
                p = Math.min(p, 2);
                ++a[p];
            }
            boolean spareTwo = false;
            if (a[0] > 0) {
                if (a[0] > a[2] + 1) {
                    out.println("No");
                    return;
                }
                if (a[0] < a[2] + 1) {
                    spareTwo = true;
                }
            }
            if ((a[1] == 1 || a[0] > 0 && a[1] > 0) && !spareTwo) {
                out.println("No");
                return;
            }
            out.println("Yes");
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}



Measured memory_bytes: 34528
object Main {
    def main(args: Array[String]) = {
        val inf = Int.MaxValue-10000
        val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt)).toList
        val Array(v, _, r) = in.head
        val g = Array.fill(v)(inf)
        g(r) = 0
        var flag = true
        while(flag) {
            flag = false
            for (b <- in.tail) if (g(b(0)) + b(2) < g(b(1))) {g(b(1)) = g(b(0)) + b(2); flag = true}
        }
        g.foreach(n => if (n == inf) println("INF") else println(n))
    }
}

Measured memory_bytes: 344932
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
#include <complex>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

int main(){
  int total_test_cases;
  while(~scanf("%d",&total_test_cases)){
    for(int test_i = 0; test_i < total_test_cases; test_i++){
      int total_staff;
      int speech_duration,prohibited_duration;

      scanf("%d %d %d",&total_staff,
            &speech_duration,&prohibited_duration);
      double customer_x,customer_y;
      scanf("%lf %lf",&customer_x,&customer_y);
      vector<complex<double> > staff;
      for(int staff_i = 0; staff_i < total_staff; staff_i++){
        double x,y;
        scanf("%lf %lf",&x,&y);
        staff.push_back(complex<double>(x,y));
      }
      
      int latest_speech_finished_time[1001];
      memset(latest_speech_finished_time,-1,sizeof(latest_speech_finished_time));
      queue<int> que;
      for(int staff_i = 0; staff_i < total_staff; staff_i++){
        if(abs(staff[staff_i] - complex<double>(customer_x,customer_y)) > 10.0) continue;
        que.push(staff_i);
        latest_speech_finished_time[staff_i] = speech_duration;
      }
      
      vector<int> edges[1001];
      for(int staff_i = 0; staff_i < total_staff; staff_i++){
        for(int staff_j = 0; staff_j < total_staff; staff_j++){
          if(staff_i == staff_j) continue;
          if(abs(staff[staff_i] - staff[staff_j]) > 50.0) continue;
          edges[staff_i].push_back(staff_j);
        }
      }

      bool isok = false;
      for(int round = 0; round < 100000; round++){
        queue<int> next;
        bool visited[1001] = {};
        while(!que.empty()){
          int staff_i = que.front();
          que.pop();
          for(int i = 0; i < edges[staff_i].size(); i++){
            int staff_j = edges[staff_i][i];
            if(latest_speech_finished_time[staff_j] == -1 
               || (latest_speech_finished_time[staff_j] + prohibited_duration
                   < latest_speech_finished_time[staff_i])){
              if(visited[staff_j]) continue;
              next.push(staff_j);
              visited[staff_j] = true;
              latest_speech_finished_time[staff_j]
                = latest_speech_finished_time[staff_i] + speech_duration;
            }
          }
        }
        if(next.empty()){
          isok = true;
          break;
        }
        que = next;
      }
      
      int res = 0;
      for(int i = 0; i < total_staff; i++){
        res = max(res,latest_speech_finished_time[i]);
      }
      if(isok){
        printf("%d\n",res);
      }
      else{
        printf("You're always welcome!\n");
      }
    }
  }
}

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

int judgeprime(long num){
  int primeflag=1,i;

  if(num%2==0){primeflag=0;}
  else if(1){
    for(i=3;i<sqrt(num)+1;i+=2){
      if( num%i==0 ){
	primeflag=0;
	break;
      }
    }
  }

  if(num==0||num==1){primeflag=0;}
  else if(num==2){primeflag=1;}

  return primeflag;

}


int main(void){
  long i,j=0,prime[500000],num;

  for(i=0;i<1000000;i++){
    if(  judgeprime(i) ){
      prime[j]=i;
      j++;
    }
  }
  prime[j]=1000001;

  while( scanf("%ld",&num) != -1 ){
    for(i=0;i<j+1;i++){
      if( prime[i]>num ){
	break;
      }
    }
    printf("%ld\n",i);
  }

  return 0;  
}

Measured memory_bytes: 1216
#include <iostream>
#include <stdio.h>
#include <vector>

int main()
{
  int n;
  int k;
  scanf("%d %d", &n, &k);
  std::vector<int> values(n, 0);
  for(int i = 0; scanf("%d", &values[i])!=EOF; i++){}
  std::vector<int> arr(n, 0);
  for (int i=1; i<n; i++){
    int cur_best = arr[i-1] + std::abs(values[i] - values[i-1]);
    for (int j=2; j<k+1; j++){
      if (i-j>-1){
        if (arr[i-j] < cur_best){
          cur_best = std::min(cur_best, arr[i-j] + std::abs(values[i] - values[i-j]));
        }
      }
    }
    arr[i] = cur_best;
  }
  printf("%d", arr[n-1]);
}


Measured memory_bytes: 1024
n,m=map(int, input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
ans=0
for i in range(n-m+1):
    for j in range(n-m+1):
        if a[i][j:j+m]==b[0]:
            t=0
            for k in range(1,m):
                if a[i+k][j:j+m]!=b[k]:
                    t+=1
            if t==0:
                ans+=1
print('Yes' if ans else 'No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<(k) ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=(k) ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef jayinnn
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
const ll MAXN = 100005;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    string s, t;
    cin >> s >> t;
    ll ans = INF;
    int sz = s.size();
    int sz_ = t.size();
    for(int i=0;i<sz-sz_+1;i++){
        ll tmp = 0;
        int idx = i;
        for(int j=0;j<sz_;j++){
            if(s[idx++] != t[j]) tmp ++;
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  int a,b,c,d,z;
  cin >> a>>b;
  for(int i=0;i<1100;i++){
    c=i*0.08;
    d=i*0.1;
    if(c==a && d==b){
      cout <<i<<endl;
      z++;
      return 0;
    }
  }
  cout <<-1<<endl;
}


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

int main() {
	int n, mx = 0;
	string aux;
	map <string, int> S;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> aux;
		S[aux]++;
	}

	for (auto x : S) {
		mx = max(mx, x.second);
	}
	for (auto x : S) {
		if (x.second == mx)
			cout << x.first << '\n';
	}
	return 0;
}

Measured memory_bytes: 25216
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt(); //繰り返す回数
    int a;  //割られる数＿最大公約数
    int b;  //割る数
    int c;  //あまり
    int max;  //最大公約数
    int sum = 0;

    for(int i=1;i<=k;i++){
      for(int j=1;j<=k;j++){
        for(int l=1;l<=k;l++){
          if(i>j){
            a = i;
            b = j;
            c = 1;
          }else{
            a = j;
            b = i;
            c = 1;
          }       
          while(c!=0){
            c = a%b;
            a = b;
            b = c;
          }
          max = a;
          if(max>l){
            a = max;
            b = l;
            c = 1;
          }else{
            a = l;
            b = max;
            c = 1;
          }       
          while(c!=0){
            c = a%b;
            a = b;
            b = c;
          }
          max = a;
          sum = sum+max;
        }
      }
    }
    System.out.println(sum);
  }
}

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

vector<bool> seen;

/*
//深さ優先探索
void dfs(const vector<vector<int>> &g, int v){
    seen.at(v) = true;

    for (auto next_v: g.at(v)){
        if(seen.at(next_v)) continue;
        dfs(g, next_v);
    }
}
*/

int proc_dfs(const vector<vector<int>> &g, int v){
    bool b = true;
    for (bool s: seen){
        if (s == false) b = false;
    }
    if (b == true) {
        return 1;
    }

    int ret = 0;
    for (auto next_v: g.at(v)){
        if(seen.at(next_v) == true) continue;
        seen.at(next_v) = true;
        ret += proc_dfs(g, next_v);
        seen.at(next_v) = false;
    }
    return ret;
}

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

    int a, b;
    vector<vector<int>> g(n);
    for(int i=0; i<m; i++){
        cin >> a >> b;
        a--; b--;
        g.at(a).push_back(b);
        g.at(b).push_back(a);
    }

    seen.assign(n, false);

    seen.at(0) = true;
    cout << proc_dfs(g, 0) << endl;
    return 0;
}


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

int main(){
  int X;
  cin >> X;
  int ans = 1;
  for (int b = 2; b <= X; b++) {
    int power = b*b;
    for (int p = 0;; p++) {
      if(power>X) break;
      ans = max(ans,power);
      power *= b;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input().strip())
a = list(map(int, input().strip().split()))

p = 0
c = 1
i = 0
ans = 0
while i < n:
    if a[i] == c:
        p = i + 1
        c += 1
    else:
        ans += 1

    i += 1



if p == 0:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 26012
#include <iostream>
#include <string>

using namespace std;

int main (void) {
	int months[12];
	
	months[ 1 - 1] = 31;
	months[ 2 - 1] = 29;
	months[ 3 - 1] = 31;
	months[ 4 - 1] = 30;
	months[ 5 - 1] = 31;
	months[ 6 - 1] = 30;
	months[ 7 - 1] = 31;
	months[ 8 - 1] = 31;
	months[ 9 - 1] = 30;
	months[10 - 1] = 31;
	months[11 - 1] = 30;
	months[12 - 1] = 31;
	
	string days[7] = {
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};
	
	for (;;) {
		int m, d, dSum;
		cin >> m;
		cin >> d;
		
		if (m == 0 && d == 0) {
			break;
		}
		
		dSum = 0;
		for (int i = 0; i < m - 1; i ++) {
			dSum += months[i];
		}
		
		dSum += d - 1;
		
		cout << days[dSum % 7] << endl;
	}
	
	return 0;
}

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

using namespace std;

int main(void) {
    long int n, k, a, de;
    long int ans = 1000000000000000001;
    vector<int> acc;

    cin >> n >> k;

    acc.push_back(n);

    
    while(!(ans == 0)){
        if(n >= k){
            de = n / k;
            a = abs(n - (k * de));
            //a = abs(n-k);
            ans = min(ans, a);
            acc.push_back(a);
            n = a;
            //cout << "flag1" << endl;
        }
        else{
            a = abs(n - k);
            if(ans < a){
                goto OUT;
            }
            ans = min(ans, a);
                        // cout << "n=" << n << endl;
                        // cout << "k=" << k << endl;
                        // cout << "a=" << a << endl;
                        // cout << "ans=" << ans << endl;
            // for(int i = 0; i < acc.size(); i++){
            //     //cout << "acc[" << i << "]=" << acc[i] << endl;
            //     if(acc[i] == a){
            //         goto OUT;
            //     }
            // }
                        //a = abs(n - k);
            acc.push_back(a);
            //ans = min(ans, a);
            n = a;

            //cout << "hoge" << endl;
        }
    }
    OUT:

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >>n >> m;
  n *= m;
  if(n % 2)puts("Odd");
  else puts("Even");
  return 0;
}

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

using namespace std;

int main(void)
{
    int N, A, B;
    cin >> N >> A >> B;
    int sum = N * A;
    if(sum > B){
        cout << B << endl;
    }
    else{
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 200010;

int n, m, K, d, a[100];
double ans;

void dfs(int cur){
    if(cur == n){
        int sum = 0;
        rep(i, n) sum += a[i];
        ans += 1.0 * max(1, sum-K) / d;
        return;
    }
    For(i, 1, m+1){
        a[cur] = i;
        dfs(cur+1);
    }
}

int main(){
    while(scanf("%d%d%d", &n, &m, &K) && n){
        d = 1;
        rep(_, n) d *= m;
        ans = 0;
        dfs(0);
        printf("%.20lf\n", ans);
    }
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
using namespace std;
int  main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    int cnt=2;
    int ans=0;
    while(cnt)
    {
        if(a>b)
        {
            ans+=a;
            a-=1;
        }
        else
        {
            ans+=b;
            b-=1;
        }
        cnt-=1;

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


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

int main() {
	int n, a = 0;
	cin >> n;
	if (n >= 105) a++;
	if (n >= 135) a++;
	if (n >= 165) a++;
	if (n >= 189) a++;
	if (n >= 195) a++;
	cout << a << endl;
}

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

typedef __int128 Hash;

const Hash M=1e18+9;
const Hash A=1e9+7;
const Hash B=1e6+1;
const Hash C=997;

void reg(Hash &x){
  x=(x%M+M)%M;
}

//ax+by==gcd(a,b);

int exgcd(Hash a,Hash b,Hash &x,Hash &y){
  if(b==0){
    x=1;
    y=0;
    return a;
  }
  Hash xx;
  Hash yy;
  int res=exgcd(b,a-(a/b)*b,xx,yy);
  //bxx+(a-(a/b)*b)yy==gcd(a,b)
  //(-(b/a)*yy)*a+(xx+yy)*b==gcd(a,b)
  x=yy;
  y=xx-(a/b)*yy;
  reg(x);
  reg(y);
  return res;
}

Hash mod_inverse(Hash h){
  Hash x,y;
  exgcd(h,M,x,y);
  return x;
}


int main(){
  int n,m;
  cin>>n>>m;
  string s;
  cin>>s;
  set<Hash> hash_set;
  int l=0,r=1;
  map<char,Hash> table;
  Hash revA;
  revA=mod_inverse(A);
  reg(revA);

  vector<Hash> powh(n);
  powh[0]=1;
  for(int i=1;i<n;i++){
    powh[i]=powh[i-1]*A;
    reg(powh[i]);
  }
  
  table['a']=B+C;


  for(char x='b';x<='z';x++){
    table[x]=table[x-1]*B+C;
    table[x]=table[x]%A;

  }
  Hash hash=table[s[0]];
  
  for(int i=0;i<m;i++){
    string op;
    cin>>op;
    if(op[0]=='R'){
      if(op[1]=='+'){
	hash*=A;
	reg(hash);
	hash+=table[s[r]];
	reg(hash);
	r++;
      }
      else{
	r--;
	hash-=table[s[r]];
	reg(hash);
	hash*=revA;
	reg(hash);
      }
    }
    else{
      if(op[1]=='+'){
	hash-=table[s[l]]*powh[r-l-1];
	reg(hash);
	l++;
      }
      else{
	l--;
	hash+=table[s[l]]*powh[r-l-1];
	reg(hash);
      }
    }
    hash_set.insert(hash);
    
  }
  cout<<hash_set.size()<<endl;
  return 0;
}

Measured memory_bytes: 26416
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 c0 = 0;
			int c1 = 0;
			int c2 = 0;
			int c3 = 0;
			
			for(int  i = 0 ; i < n ; i++ ) {
				String s = sc.next();
				
				switch(s) {
				case "AC":
					c0++;
					break;
				case "WA":
					c1++;
					break;
				case "TLE":
					c2++;
					break;
				default:
					c3++;
					break;
				}
				
			}
			
			System.out.println("AC x " + c0);
			System.out.println("WA x " + c1);
			System.out.println("TLE x " + c2);
			System.out.println("RE x " + c3);
		}
	}

}

Measured memory_bytes: 58576
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
class point {
public:
	int color;
	int nf;
	vector<int> road;
	int lu;
	point() :color(0), nf(-1), lu(-1) {

	}
};
#define pa pair<int,int>
int main() {
	int N, M;
	cin >> N >> M;
	vector<point> map(N + 1);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		map[a].road.push_back(b);
		map[b].road.push_back(a);
	}
	int time;
	cin >> time;
	vector<int> place(time), distance(time), newcolor(time);
	for (int i = time - 1; i >= 0; --i) {
		cin >> place[i] >> distance[i] >> newcolor[i];
	}
	queue<pa> que;
	for (int i = 0; i < time; ++i) {
		if (map[place[i]].nf >= distance[i]) {
			continue;
		}
		map[place[i]].lu = i;
		que.push(pa(place[i], 0));
		while (!que.empty()) {
			pa dummy = que.front(); que.pop();
			if (dummy.second > distance[i])continue;
			if (map[dummy.first].nf >= distance[i] - dummy.second) {
				continue;
			}
			map[dummy.first].nf = distance[i] - dummy.second;
			if (map[dummy.first].color == 0) {
				map[dummy.first].color = newcolor[i];
			}
			for (int j = 0, nmax = map[dummy.first].road.size(); j < nmax; ++j) {
				if (map[map[dummy.first].road[j]].lu != i) {
					map[map[dummy.first].road[j]].lu = i;
					que.push(pa(map[dummy.first].road[j], dummy.second + 1));
				}
			}
		}
	}
	for (int i = 1; i <= N; ++i) {
		cout << map[i].color << endl;
	}
	return 0;
}

Measured memory_bytes: 9768
n = int(input())
A = list(map(int,input().split()))
q = int(input())
total = sum(A)

l = [[i, 0] for i in range(10**5+1)]
for _ in range(n):
    l[A[_]][1] += 1

for i in range(q):
    b, c = map(int,input().split())
    total -= (l[b][0] * l[b][1])
    total += (l[c][0] * l[b][1])
    print(total)
    l[c][1] += l[b][1]
    l[b][1] = 0

Measured memory_bytes: 24960
from bisect import bisect_left, bisect_right

N = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))

answer = 0
CL = len(C)
for b in B:
    ai = bisect_left(A, b)
    ci = bisect_right(C, b)
    answer += ai * (CL - ci)
print(answer)

Measured memory_bytes: 23360
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void){
	std::ios_base::sync_with_stdio();
	
	int n;
	int C,A,N;
	/*Ｃ： コーダー       言語を熟知しており、コーディングを行う。 */
	/*Ａ： アルゴリズマー 論理的思考が得意であり、アルゴリズムを考える。 */
	/*Ｎ： ナビゲーター   読解力に長けており、問題の分析・デバッグをする。 */
	int ans;

	cin>>n;

	for(int i=0;i<n;i++){
		cin>>C>>A>>N;
		ans=0;
		/*ＣＡＮ：正確に問題を解く慎重型*/
		while(C>=1&&A>=1&&N>=1){
			ans++;
			C--,A--,N--;
		}
		/*ＣＣＡ：バランスがとれている安定型*/
		while(C>=2&&A>=1){
			ans++;
			C-=2,A--;
		}
		/*ＣＡＮ：スピードを見込めるがリスクの高い速攻型*/
		while(C>=3){
			ans++;
			C-=3;
		}
		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >> p.second;
	return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
	rep(i, v.size()) { is >> v[i]; }
	return is;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	int n, k;
	ll ans = -INF;
	cin >> n >> k;
	vector<vector<tuple<int, ll, ll>>> tri(n, vector<tuple<int, ll, ll>>(33,mt(0,-INF,-INF)));
	int p;
	ll c;
	rep(i, n) {
		cin >> p;
		get<0>(tri[i][0]) = p-1;
	}
	rep(i, n) {
		cin >> c;
		get<1>(tri[i][0]) = c;
		get<2>(tri[i][0]) = c;

	}
	for (int j = 0; j < 32;j++) {
		rep(i, n) { 
			get<0>(tri[i][j+1]) = get<0>(tri[get<0>(tri[i][j])][j]);
			get<1>(tri[i][j+1]) = get<1>(tri[i][j]) +
			                    get<1>(tri[get<0>(tri[i][j])][j]);
			get<2>(tri[i][j+1]) = max(get<2>(tri[i][j]),
			                        get<1>(tri[i][j]) + get<2>(tri[get<0>(tri[i][j])][j]));
		}
	}
//	rep(j,33){
//		rep(i,n){
		//	clog << get<0>(tri[i][j]) << " " << get<1>(tri[i][j]) << " "
		//	     << get<2>(tri[i][j]) << " | ";
//		}
//		clog << endl;
//	}

	clog << endl;
	ll now = 0LL;
	int at;
	rep(i,n){
		at = i;
		now = 0LL;
		for (int j = 32; j >= 0; j--) {
			if (k & (1LL << j)) {
				
				chmax(ans, now + get<2>(tri[at][j]));
				now += get<1>(tri[at][j]);

				at = get<0>(tri[at][j]);
			//	clog << at << " " << now << endl;
			}

		}
	//	clog << " ::"<<now << endl;
	} 
	cout << ans << endl;
}

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

int main()
{
    // Input
    int n;
    cin >> n;

    vector<int> vecA(n);
    for(int i=0; i<n; i++)  cin >> vecA.at(i);

    // Calc
    vector<int> vecB(n);
    for(int i=n; i>=1; i--){
        int mod = 0;
        for(int j=2; i*j<=n; j++)
            mod += vecB[i*j-1];
        mod = mod%2;

        vecB[i-1] = (vecA[i-1] != mod) ? 1 : 0;
    }

    vector<int> vecAns;
    for(int i=0; i<vecB.size(); i++){
        if(vecB[i] == 0) continue;
        vecAns.push_back(i+1);
    }

    // Output
    cout << vecAns.size() << endl;
    for(int i=0; i<vecAns.size(); i++)
        printf("%d%c", vecAns[i], i+1==vecAns.size() ? '\n' : ' ');

    return 0;
}

Measured memory_bytes: 3064
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
ll mod = 1e9+7;

inline void mult(ll& a,ll b){
    (a %= mod) *= b;
    a %= mod;
}
inline void add(ll& a,ll b){
    a += b;
    if(a >= 0) a %= mod;
    else (a += mod) %= mod;
}

int main(void){
    ll n;scanf("%lld",&n);
    vector<ll> s(100010,0);
    s[0] = 3;
    ll mod = 1e9+7;
    ll ans = 1LL;
    for (int i = 0; i < n; ++i)
    {
        ll x;cin >> x;
        mult(ans,s[(++x) - 1] - s[x]);
        s[x]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cmath>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define ppb pop_back

using namespace std;
template<typename T> using vec = vector<T>;
using ll = long long;

int main(int argc,char* argv[])
{
    int N,M;
    cin>>N>>M;
    vec<int> mins(M);
    vec<int> maxs(M);
    rep(i,M)cin>>mins[i]>>maxs[i];
    int mini=mins[0],max = maxs[0];
    rep(i,M){
        if(mini < mins[i])mini = mins[i];
        if(max > maxs[i])max = maxs[i]; 
    }
    if(mini <= max)cout<<max-mini+1<<endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int A1 = sc.nextInt();
        int A2 = sc.nextInt();
        int A3 = sc.nextInt();
        sc.close();
        
        if(A1 + A2 + A3 >= 22) {
        	System.out.println("bust");
        }
        else if(A1 + A2 + A3 <= 21) {
        	System.out.println("win");
        }
	}
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    string s;
    cin >> s;

    if(s == "ABC"){
        cout << "ARC" << "\n";
    }else{
        cout << "ABC" << "\n";
    }


    return 0;
}


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

int main() {
  int n, k;
  cin >> n;
  cin >> k;
  int *h = new int[n + 1];
  int *dp = new int[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
  }
  dp[1] = 0;
  dp[2] = dp[1] + abs(h[1] - h[2]);
  for (int i = 3; i <= n; i++) {
    int min_val = INT_MAX;
    for (int j = 1; j <= k; j++) {
      if (i > j) {
        // cout << h[i] << ' ' << h[i - j] << ' ' << dp[i - j] << endl;
        min_val = min(min_val, dp[i - j] + abs(h[i] - h[i - j]));
      } else {
        break;
      }
    }
    dp[i] = min_val;
  }
  //   for (int i = 1; i <= n; i++) {
  //     cout << dp[i] << endl;
  //   }
  cout << dp[n];
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> D(N);
  
  for (int i=0; i<N ;i++){
    int di;
    cin >> di;
    D.at(i)=di;
  }
  sort(D.begin(), D.end());
  
  int sum=0;
  
  for (int i=0; i<N-1 ;i++){
    if (D.at(i)!=D.at(i+1)){
      sum++;
    }
  }
  cout << sum+1<<endl;
}
  
  

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

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define INF (1 << 29)
#define MOD 10000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){

  int r;
  cin >> r;
  cout << r*r;
  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 N = sc.nextInt();
		int[] cell = new int[N];
		int max = 0;
		String ans = "Yes";
		
		for(int i = 1; i <= N; i++) {
			cell[i-1] = sc.nextInt();
		}
		
		for(int j = 1; j <= N; j++) {
			if(max <= cell[j-1]) {
				max = cell[j-1];
			} else {
				if(max -1 > cell[j-1]) {
					
					ans = "No";
				}
			}
		}
		
		System.out.println(ans);
	}

}


Measured memory_bytes: 50760
#include<iostream>
using namespace std;
int main()
{
  int k,a,b,i,f=0;
  cin>>k;
  cin>>a>>b;
  for(i=a;i<=b;i++)
  {
    if(i%k==0)
    {
      f=1;
      break;
    }
  }
  if(f==1)
    cout<<"OK";
  else
    cout<<"NG";
  return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<fstream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<ctime>
#include<queue>
using namespace std;
#define int long long
#define pii pair <int, int>
#define XX first
#define YY second

// constants:
const int mn = 200005;
const int mod = 1000000007;
const long long inf = 4444444444444444444;
const int sminf = 1111111111;
const bool is_multitest = 0;
const bool is_interactive = 0;

// i/o methods:
const bool input_from_file = 0;
const bool output_to_file = 0;
#define filename ""
#define in_extension "inp"
#define out_extension "out"

// data preprocessing: (e.g.: divisor generating, prime sieve)
void preprocess()
{
    
}

// global variables:
int n, A[mn];
// main solution goes here:
void execute(int test_number)
{
    cin>>n;
    for (int i=1; i<=n; i++) cin>>A[i];
    sort(A+1, A+n+1);
    int ans = A[n];
    int p1 = n-1;
    for (int i=3; i<=n; i++) {
        ans+=A[p1];
        if (i%2==0) p1--;
    }
    cout<<ans;
}
// REMEMBER TO CHOOSE TEST METHODS
// PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS
// Solution by low_



















signed main()
{
#ifdef lowie
    if (!is_interactive)
    {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
#else
    if (input_from_file) freopen(filename"."in_extension, "r", stdin);
    if (output_to_file) freopen(filename"."out_extension, "w", stdout);
#endif
    if (!is_interactive)
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }

    preprocess();
    int ntest;
    if (is_multitest) cin >> ntest;
    else ntest = 1;

    for (int testno = 1; testno <= ntest; testno++)
    // use for instead of while to serve facebook hacker cup test format
    {
        execute(testno); // only start coding in this function, not in main
    }
}
// Template by low_
// Contact me via mail: ttuandung1803@gmail.com
// ...or codeforces: www.codeforces.com/profiles/low_
// ...or if you're interested in food: www.instagram.com/lowie.exe/

Measured memory_bytes: 5200
N = gets.chomp.to_i
B = gets.chomp.split.map(&:to_i)
A = Array.new(N)
if N == 2
  puts B[0] * 2
  exit
end
if B[0] > B[1]
  A[0] = B[0]
  A[1] = B[1]
elsif B[0] <= B[1]
  A[0] = A[1] = B[0]
end
(2..B.length-1).each do |i|
  A[i] = [B[i-1], B[i]].min
end
A[-1] = B[-1]
puts A.inject(:+)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m,a[1009],ans,x[1009],y[1009],z[1009];
    cin >> n >> m;
    for(int i=0; i<n; i++)
    {
        cin >> x[i] >> y[i] >> z[i] ;
    }
    ans=-1e10;
    for(int i=-1; i<=1; i++)
    {
        if(i==0) continue;
        for(int j=-1; j<=1; j++)
        {
            if(j==0) continue;
            for(int k=-1; k<=1; k++)
            {
                if(k==0) continue;
                for(int h=0; h<n; h++) a[h]=i*x[h]+j*y[h]+k*z[h];
                sort(a,a+n);
                long long ma=0;
                for(int h=n-1; h>=n-m; h--) ma+=a[h];
                ans=max(ans,ma);
            }
        }
    }
    printf("%lld\n",ans);

}


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

typedef long long ll;

const int MAXN = ((int)2e5) + 1;
string s;
int n, a, b, c, d;

bool ok(int x, int y) {
	for(int i = x+2; i < y; i++) {
		if(s[i] == '#' && s[i-1] == '#') return 0;
	}
	return 1;
}

int main() {
	ios_base::sync_with_stdio(0);
	
	cin >> n >> a >> b >> c >> d;
	cin >> s;
	
	a--, b--, c--, d--;
	
	if(c < d) cout << (ok(a,c) && ok(b,d) ? "Yes\n" : "No\n");
	else {
		if(!ok(b,d)) cout << "No\n";
		else {
			bool yes = 0;
			for(int i = b; i <= d; i++) {
				if(s[i] != '#' && s[i-1] != '#' && s[i+1] != '#') yes = 1;
			}
			cout << (yes ? "Yes\n" : "No\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 592
N, M = map(int, input().split())
possible_num = ["X"] * N
memo = [-1]*N
ans = ""

for _ in range(M):
    si, ci = input().split()
    si = int(si)
    if memo[si-1] != -1 and memo[si-1] != ci:
        print(-1)
        quit()
    memo[si-1] = ci
    possible_num[si-1] = ci

if N >= 2 and possible_num[0] == "0":
    print(-1)
    quit()
elif N >= 2 and possible_num[0] == "X":
    possible_num[0] = "1"

for item in possible_num:
    if item == "X":
        item = 0
    ans += str(item)

print(int(ans))


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    int h, w;
    
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0)
            break;
        else{
            for(int i=0; i < h; i++){
                for(int j=0; j < w; j++){
                    if((i+j)%2 == 0)
                        cout << "#";
                    else
                        cout << ".";
                }
                cout << endl;
            }
            cout << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3076
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var t=sc.S;
		int n=t.Length,r=0,l=0;
		var a=new int[n];
		for(int i = 0;i<n-1;i++) {
			if(t[i]=='R'&&t[i+1]=='L'){
				a[i]=1+(r/2);
				a[i+1]=1+(r/2)+(r%2);
				r=0;
				for(int j = 2;j+i<n;j++) {
					if(t[j+i]=='L'){a[i+(j%2)]++;}
					else{break;}
				}

			}
			else if(t[i]=='R'){r++;}
		}
		Console.WriteLine("{0}",String.Join(" ",a));
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


Measured memory_bytes: 15968
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll x[55], y[55];
int n, k;

vector<vector<int>> ret;

void prep(vector<int> v){
    if (v.size()==5) {
        ret.push_back(v);
        return;
    }
    int b = v.back();
    rep(i, n) {
        if (i < b) continue;
        v.push_back(i);
        prep(v);
        v.pop_back();
    }
}

int main(){
    cin >> n >> k;
    rep(i, n) cin >> x[i] >> y[i];
    vector<int> ini;
    ini.push_back(0);

    prep(ini);
    ll ans = 5e18;

    rep(i, ret.size()){
        ll max_x = -LINF, max_y = -LINF, min_x = LINF, min_y = LINF;
        for(int j = 1; j <= min(k, 4); j++) {
            max_x = max(max_x, x[ret[i][j]]);
            min_x = min(min_x, x[ret[i][j]]);
            max_y = max(max_y, y[ret[i][j]]);
            min_y = min(min_y, y[ret[i][j]]);
        }
        int cnt = 0;
        rep(j, n) if (min_x <= x[j] && x[j] <= max_x && min_y <= y[j] && y[j] <= max_y) cnt++;
        if (cnt < k) continue;
        ans = min(ans, (max_x - min_x) * (max_y - min_y));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 23756
#include<bits/stdc++.h>
using namespace std;
#define I_O		ios::sync_with_stdio(false),cin.tie(0)
#define ll		long long
#define mod 	1000000007
#define rep(i,n)	for(int i=1;i<=n;i++)
#define pb 		push_back
int main()
{
	I_O;
	ll a,b,c,k;	cin>>a>>b>>c>>k;
	if(k<=a)return cout<<k,0;
	if(k<=(a+b))return cout<<a,0;
	ll sum = k - (a+b);
	sum = a - sum;
	cout<<sum;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

vector<string> ans;
vector<vll> xy;
void err(){
  std::cout << -1 << '\n';
  exit(0);
}
int od = -1;
void solve(ll num){
  string tmp = "";
  ll x=xy[num][0], y=xy[num][1];
  while(true){
    if((abs(y) + abs(x)) == 1){
      if(x==-1) tmp += 'L';
      if(x==1) tmp += 'R';
      if(y==1) tmp += 'U';
      if(y==-1) tmp += 'D';
      break;
    }
    if(abs(x)%2){
      if((abs(y/2)%2)!=(abs((x+1)/2)%2)) tmp += 'L', x++;
      else if((abs(y/2)%2)!=(abs((x-1)/2)%2)) tmp += 'R', x--;
    }else{
      if((abs(x/2)%2)!=(abs((y+1)/2)%2)) tmp += 'D', y++;
      else if((abs(x/2)%2)!=(abs((y-1)/2)%2)) tmp += 'U', y--;
    }
    x/=2, y/=2;
  }
  ans.push_back(tmp);
}
int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  re(i, n){
    ll x, y;std::cin >> x >> y;
    if(od!=-1&&od!=abs(x+y)%2) err();
    else od = (x+y)%2;
    if(od) xy.push_back(vll{x, y});
    else xy.push_back(vll{x+1, y});
  }
  re(i, n) solve(i);
  if(od){
    std::cout << 31 << '\n';
    re(i, 31) std::cout << (1<<i) << (i==30?"\n":" ");
    re(i, n){
      string ret = "";
      for(int j=0;j<ans[i].size()-1;j++) ret += ans[i][j];
      char las = ans[i][ans[i].size()-1];
      char rev;
      if(las=='R') rev = 'L';
      if(las=='L') rev = 'R';
      if(las=='U') rev = 'D';
      if(las=='D') rev = 'U';
      for(int j=ans[i].size()-1;j<30;j++) ret += rev;
      ret += las;
      std::cout << ret << '\n';
    }
  }else{
    std::cout << 32 << '\n';
    std::cout << 1 << " ";
    re(i, 31) std::cout << (1<<i) << (i==30?"\n":" ");
    re(i, n) {
      string ret = "L";
      for(int j=0;j<ans[i].size()-1;j++) ret += ans[i][j];
      char las = ans[i][ans[i].size()-1];
      char rev;
      if(las=='R') rev = 'L';
      if(las=='L') rev = 'R';
      if(las=='U') rev = 'D';
      if(las=='D') rev = 'U';
      for(int j=ans[i].size()-1;j<30;j++) ret += rev;
      ret += las;
      std::cout << ret << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> v(n);
  rep (i, n) cin >> v[i];
  vector<unordered_map<int, int>> cnt(2);
  rep (i, n) cnt[i & 1][v[i]]++;
  vector<pair<int, int>> maxi1(2), maxi2(2);
  rep (i, 2) {
    allrep (x, cnt[i]) {
      if (x.second >= maxi1[i].second) {
        maxi2[i] = maxi1[i];
        maxi1[i] = x;
      } else if (x.second > maxi2[i].second) {
        maxi2[i] = x;
      }
    }
  }
  int maxi = 0;
  if (maxi1[0].first != maxi1[1].first) {
    maxi = maxi1[0].second + maxi1[1].second;
  } else {
    rep (i, 2) {
      if (maxi1[i].first != maxi2[!i].first) {
        maxi = max(maxi, maxi1[i].second + maxi2[!i].second);
      }
    }
  }
  cout << n - maxi << endl;
  return 0;
}

Measured memory_bytes: 4760
#include <cstdio>
#include <iostream>

using namespace std;

typedef unsigned long long ullong;

const int DIV = 1000000007;

ullong power(ullong m, ullong n) {
	if (n == 0)
		return 1;
	ullong res = power(m * m % DIV, n / 2);
	if (n % 2 != 0) {
		res = res * m % DIV;
	}
	return res;
}
int main() {

	int m, n;
	scanf("%d %d", &m, &n);
	cout << power(m, n) << endl;

	return 0;
}

Measured memory_bytes: 3208