akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll ac(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int dp[3002][3002];
int main()
{
	int n, t, A, B;
	cin >> n >> t;
	vector<int> a(n), b(n);
	vector<pair<int, int>> data(n);
	rep(i, 0, n)cin >> A >> B, data[i] = {A, B};
	sort(all(data));
	rep(i, 0, n)a[i] = data[i].first, b[i] = data[i].second;
	vector<int> kouho;
	int M = 0;
	rep(i, 0, t) {
		rep(i2, 0, n) {
			if (i + a[i2] < t)dp[i2 + 1][i + a[i2]] = max(dp[i2][i] + b[i2], dp[i2 + 1][i + a[i2]]);
			else {
				M = max(dp[i2][i] + b[i2], M);
			}
			dp[i2 + 1][i] = max(dp[i2][i], dp[i2 + 1][i]);
		}
	}
	printf("%d\n", M);
	return 0;
}


Measured memory_bytes: 38876
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,n;cin>>h>>n;
    int a;
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>a;
        sum+=a;
    }
    if(sum>=h){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
/**
 *  author:   TakeruOkuyama
 *  created:  
**/
#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 MOD = 1000000007;
const int INF = 999999999;

int main(){
     int N, Y;
     cin >> N >> Y;
     //int ans = 0;
     rep(a, N+1){
         rep(b, N+1){
             if(0 <= N - (a + b)){
                 int c = N - (a + b);
                 if(a*10000 + b*5000 + c*1000 == Y){
                     //ans++;
                     cout << a << " " << b << " " << c << endl;
                     return 0;
                 }
             }
         }
     }
     cout << "-1 -1 -1" << endl;
return 0;}

/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

typedef pair<ll, ll> pll;
const ll INF = (ll)1e18;

signed main() {
	int n;
	cin >> n;
	int sum = 0;
	for (size_t i = 0; i < 8; i ++) {
		sum += ((int) (n / pow(10, i))) % 10;
		// cout << ((int) (n / pow(10, i))) << endl;
	}

	// cout << sum << endl;;
	cout << ((n % sum == 0) ? "Yes" : "No") << endl;
}


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

struct DATA{
  int player,wakasagi;
};

int n,q,a,v,top_player,cnt=0;
int wakasagi_sum[1000001];
DATA data[1000001];

void heep_in(int);
int heep_out(void);

int main(){
  
  cin >>n>>q;
  
  for(int i=0 ; i < 1000001 ; i++){
    data[i].wakasagi=-1;
    data[i].player=1e9;
    wakasagi_sum[i]=0;
  }  
  for(int i=0 ; i < q ; i++){
    
    cin >>a>>v;
    
    wakasagi_sum[a]+=v;
    
    heep_in(a);
    
    top_player=heep_out();
    
    cout <<top_player<<" "<<wakasagi_sum[top_player]<<endl;
    
  }
  
  return 0;
}
void heep_in(int a){
  
  int number;
  
  number=++cnt;
  
  data[cnt].player=a;
  data[cnt].wakasagi=wakasagi_sum[a];
  
  while(1){
    
    if(number == 1)break;
    
    if(data[number].wakasagi >  data[number/2].wakasagi){
      swap(data[number].wakasagi,data[number/2].wakasagi);
      swap(data[number].player,data[number/2].player);
    }else if(data[number].wakasagi == data[number/2].wakasagi && data[number].player < data[number/2].player){
      swap(data[number].player,data[number/2].player);
    }else{
      break;
    }
    
    number/=2;
  }
  
}
int heep_out(void){
  
  int number,i;
  number=cnt;
  
  
  if(data[1].wakasagi == wakasagi_sum[data[1].player]){
    return data[1].player;
  }else{
    
    data[1].wakasagi=data[cnt].wakasagi;
    data[1].player=data[cnt].player;
    i=1;
    
    while(1){
      
      if(data[i*2].wakasagi > data[i*2+1].wakasagi || (data[i*2].wakasagi == data[i*2+1].wakasagi && data[i*2].player <= data[i*2+1].player)){
	
	if(data[i*2].wakasagi > data[i].wakasagi){
	  swap(data[i].wakasagi,data[i*2].wakasagi);
	  swap(data[i].player,data[i*2].player);
	  i=i*2;
	}else if(data[i*2].wakasagi == data[i].wakasagi && data[i*2].player <= data[i].player){
	  swap(data[i].player,data[i*2].player);
	  i=i*2;
	}else break; 
	
      }else if(data[i*2].wakasagi < data[i*2+1].wakasagi|| (data[i*2].wakasagi == data[i*2+1].wakasagi && data[i*2].player > data[i*2+1].player)){ 
	
	if(data[i*2+1].wakasagi > data[i].wakasagi){
	  swap(data[i].wakasagi,data[i*2+1].wakasagi);
	  swap(data[i].player,data[i*2+1].player);
	  i=i*2+1;
	}else if(data[i*2+1].wakasagi == data[i].wakasagi && data[i*2+1].player <= data[i].player){
	  swap(data[i].player,data[i*2+1].player);
	  i=i*2+1;
	}else break;
	
      }else{
	break;
      }
      
      if(i*2 > cnt)break;  
      
    }
    cnt--;
  }
  return heep_out();  
}

Measured memory_bytes: 12884
#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  map<int, int, greater<int>> mp;
  REP(i,n){
    int a;
    cin >> a;
    mp[a]++;
  }
  int x=0,y=0;
  for(auto itr=begin(mp); itr!=end(mp); itr++){
    int k = itr->first;
    int v = itr->second;
    if(x==0){
      if(v>=4){
        x = k;
        y = k;
        break;
      }else if(v>=2){
        x = k;
      }
    }else{
      if(v>=2){
        y = k;
        break;
      }
    }
  }
  cout << (ll)x*y<< '\n';
  return 0;
}

Measured memory_bytes: 4992
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

// CHECK THE LIMITS
typedef long long ll;

static const int NMAX = 1e5;

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

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

	string s;
	cin >> s;
	if(s == "SUN")
		cout << 7;
	else if(s == "MON")
	{
		cout << 6;
	}
	else if(s == "TUE")
	{
		cout << 5;
	}
	else if(s == "WED")
	{
		cout << 4;
	}
	else if(s == "THU")
	{
		cout << 3;
	}
	else if(s == "FRI")
	{
		cout << 2;
	}
	else if(s == "SAT")
	{
		cout << 1;
	}
	

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int a[7]={1,3,5,7,8,10,12};
    int b[4]={4,6,9,11};
    int c[1]={2},e,d,i,w,z,h;
    while(~scanf("%d%d",&e,&d))
    { w=0;z=0;h=0;
{
    for(i=0;i<7;i++)
    {
        if(e==a[i])
            w++;
        if(d==a[i])
            w++;
    }
    for(i=0;i<4;i++)
    {
        if(e==b[i])
            z++;
        if(d==b[i])
            z++;
    }
    for(i=0;i<1;i++)
    {
        if(e==c[i])
            h++;
        if(d==c[i])
            h++;
    }
    if(w==2||z==2||h==2)
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
}
        }

    }


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


int main() {
  ll n,a,b;
  cin>>n>>a>>b;
  auto c=a+b;
  if(n%c>a){
    cout<<(n/c)*a+a<<endl;}
  else{
    cout<<(n/c)*a+n%c<<endl;}
}


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

int main() {
    ull Radius, Count;
    vector<ull> Points;

    cin >> Radius;
    cin >> Count;

    for (ull i = 0; i < Count; i++) {
        ull t;
        cin >> t;
        Points.push_back(t);
    }

    ull Sum = 0, Max = 0;
    for (ull i = 0; i < Count; i++) {
        ull t,v = Points[i];

        if (i == 0) {
            t = v + Radius - Points[Count - 1];
        } else {
            t = v - Points[i-1];
        }
        Sum += t;
        Max = max(Max, t);
    }
    cout << Sum - Max << endl;
}


Measured memory_bytes: 2420
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int H = Integer.parseInt(sc.next());
		int W = Integer.parseInt(sc.next());
		Cell[][] cells = new Cell[H][W];
		for (int y = 0; y < H; y++) {
			char[] w = sc.next().toCharArray();
			for (int x = 0; x < W; x++) {
				cells[y][x] = new Cell();
				if (w[x] == '#') {
					cells[y][x].obs = true;
				}
			}
		}
		sc.close();

		// x方向に操作
		for (int y = 0; y < H; y++) {
			int s = 0;
			for (int x = 0; x < W; x++) {
				if (cells[y][x].obs) {
					s = 0;
					continue;
				}
				s++;
				cells[y][x].xs = s;
			}
			for (int x = W - 2; x >= 0; x--) {
				if (!cells[y][x].obs && cells[y][x + 1].xs > cells[y][x].xs) {
					cells[y][x].xs = cells[y][x + 1].xs;
				}
			}
		}

		// y方向に操作
		for (int x = 0; x < W; x++) {
			int s = 0;
			for (int y = 0; y < H; y++) {
				if (cells[y][x].obs) {
					s = 0;
					continue;
				}
				s++;
				cells[y][x].ys = s;
			}
			for (int y = H - 2; y >= 0; y--) {
				if (!cells[y][x].obs && cells[y + 1][x].ys > cells[y][x].ys) {
					cells[y][x].ys = cells[y + 1][x].ys;
				}
			}
		}

		int ans = 0;
		for (int x = 0; x < W; x++) {
			for (int y = 0; y < H; y++) {
				ans = Math.max(ans, cells[y][x].xs + cells[y][x].ys - 1);
			}
		}
		System.out.println(ans);
	}

	public static class Cell {
		int xs = 0;
		int ys = 0;
		boolean obs = false;
	}

}

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

int main(){
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.size(); i ++) {
    if (s[i] == '1') ans ++;
  }

  cout << ans << endl;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;

int main() {
 
 int n,r=0,rans=0;
 cin>>n;
 string s;
 cin>>s;
 for(int i=0;i<n;i++){
     if(s.at(i)=='R'){
         r++;
     }
 }
 for(int i=0;i<r;i++){
     if(s[i]=='W'){
         rans++;
     }
 }

 int x=min(r,n-r);
 int ans=min(x,rans);
 cout<<ans<<endl;
 
}

Measured memory_bytes: 3720
#ifndef DEBUG
#pragma GCC optimize("O3,unroll-loops")
#pragma loop_opt(on)
#endif
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#define FAST ;
#else
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define cerr
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define All(v) v.begin(),v.end()
#define Ft first
#define Sd second
using ll = long long;
using pii = pair<int, int>;
constexpr ll MOD = 998'244'353;

signed main() {
    FAST;

    int n;
    cin >> n;
    vector<int> a(n);
    for(int &x: a) cin >> x;
    vector<vector<int>> edge(n);
    Fr(i, 1, n) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        edge[u].emplace_back(v);
        edge[v].emplace_back(u);
    }
    vector<int> ans(n);
    function<void(int,int)> dfs;
    dfs = [&](int now, int par) {
        static vector<int> LCS{ a[now] };
        //cerr _ par _ now _ ": "; for(int x: LCS)  cerr _ x; cerr _ endl;
        ans[now] = LCS.size();
        for(int x: edge[now]) if (x != par) {
            size_t idx = distance(LCS.begin(), lower_bound(All(LCS),a[x]));
            int back = -1;
            if (idx == LCS.size()) {
                back = -1;
                LCS.emplace_back(a[x]);
            } else {
                back = LCS[idx];
                LCS[idx] = a[x];
            }
            dfs(x, now);
            if (back == -1) LCS.pop_back();
            else LCS[idx] = back;
        }
    };
    dfs(0,-1);
    Fr(i, 0, n) cout << ans[i]
#ifdef DEBUG
        << " \n"[i+1==n];
#else
        << endl;
#endif

}


Measured memory_bytes: 35872
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<ll> a(n + 5);
  for (int i = 0; i<n; i++){
    cin >> a[i];
  }
  if(n<=2){
    cout << 1 << "\n";
    return 0;
  }
  a[n] = 1e10 + 5;
  a[n + 1] = 1e10 + 1;

  int flagH = 0, flagL = 0;
  int count = 0;
  int i = 0;
  while (i < n){
    if(a[i] == a[i+1]){
      i++;
      continue;
    }
    if(a[i]<a[i+1]){
      flagH = true;
      while(flagH == true){
        i++;
        if(a[i]>a[i+1]){
          flagH = false;
          count++;
          i++;
        }
      }
    }
    else if(a[i]>a[i+1]){
      flagL = true;
      while(flagL==true){
        i++;
        if(a[i]<a[i+1]){
          flagL = false;
          count++;
          i++;
        }
      }
    }
  }

  cout << count << "\n";
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n;
    cin>>n;
    cout<<180*(n-2)<<endl;
    return 0;
}

Measured memory_bytes: 3604
/*
lakshaygpt28
Lakshay Gupta
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using vll = vector < ll >;

template < typename T > using OrderedMultiSet = tree < T, null_type, less_equal < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;


#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define eb emplace_back
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

int main() {
    fast_io();
    char a;
    cin >> a;
    cout << char(a + 1) << "\n";
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  string ans = "No";
  for(int i=0; i<26; i++){
    for(int j=0; j<16; j++){
      if(4*i + 7*j == N){
        ans = "Yes";
      }
    }  
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N, K = gets.chomp.split.map(&:to_i)
A = gets.chomp.split.map(&:to_i)

posi = []
nega = []
zeros = 0
A.each do |ai|
  if ai < 0
    nega << ai
  elsif ai > 0
    posi << ai
  else
    zeros += 1
  end
end

posi.sort!
nega.sort!.reverse!

nega_posi = [nega, posi]

posi_size = posi.size
nega_size = nega.size

zero_pairs = zeros * (zeros - 1) / 2 + zeros * (N - zeros)

ok =  10**18 + 1
ng = -10**18 - 1

ans = (ng..ok).bsearch do |mid|
  
  cnt = 0
  
  cnt += zero_pairs if mid >= 0

  if mid > 0
    cnt += nega_size * posi_size
    nega_posi.each do |a|
      l = 0
      r = a.size - 1
      while l < r
        r -= 1 while l < r && a[l] * a[r] > mid
        cnt += r - l
        l += 1
      end
    end
  else
    r = nega_size - 1
    posi_size.times do |l|
      r -= 1 while(r >= 0 && posi[l] * nega[r] <= mid)
      cnt += nega_size - r - 1
    end
  end

  cnt >= K
end

puts ans

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const double INF = 1e18;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int W, H;
void bfs(double dist[500][500], int sx, int sy, string grid[500]){
  queue<int> qx, qy;
  qx.push(sx); qy.push(sy);
  dist[sy][sx] = 0;
  while(!qx.empty()){
    int x = qx.front(), y = qy.front();
    qx.pop(); qy.pop();
    REP(r, 4){
      int nx = x + dx[r], ny = y + dy[r];
      if(valid(nx, ny, W, H) && grid[ny][nx] == '.'){
        if(dist[ny][nx] == -1.0 || dist[ny][nx] > dist[y][x] + 1){
          dist[ny][nx] = dist[y][x] + 1;
          qx.push(nx);
          qy.push(ny);
        }
      }
    }
  }
}

int main(){
  while(cin >> W >> H && W){
    string grid[500];
    REP(i, H) cin >> grid[i];

    int sx, sy;
    REP(y, H) REP(x, W) if(grid[y][x] == 's') {
      sx = x, sy = y;
      grid[y][x] = '.';
    }

    int N = 0;
    REP(y, H) REP(x, W) if(grid[y][x] == '.') N++;

    double dist_goal[500][500], dist_spring[500][500];
    REP(y, H) REP(x, W) dist_goal[y][x] = dist_spring[y][x] = -1.0;
    REP(y, H) REP(x, W) if(grid[y][x] == 'g') bfs(dist_goal, x, y, grid);
    REP(y, H) REP(x, W) if(grid[y][x] == '*') bfs(dist_spring, x, y, grid);
    REP(y, H) REP(x, W) if(dist_goal[y][x] == -1) dist_goal[y][x] = INF;
    REP(y, H) REP(x, W) if(dist_spring[y][x] == -1) dist_spring[y][x] = INF;

    double lb = 0, ub = 1e18;
    REP(_, 100){
      const long double sum = (ub + lb) * 0.5;
      long double S = 0;
      REP(y, H) REP(x, W)if(grid[y][x] == '.'){
        long double exp = min((long double)dist_goal[y][x], dist_spring[y][x] + sum / N);
        S += exp;
      }
      if(sum - S > 0){
        ub = sum;
      }else{
        lb = sum;
      }
    }
    double all_exp = lb / N;
    printf("%.12f\n", min((double)dist_goal[sy][sx], dist_spring[sy][sx] + all_exp));
  }
  return 0;
}

Measured memory_bytes: 5448
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
using namespace std;
const int INF = 1000000000000;
const int mod = 1000000007;
bool IsPrime(int num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}
signed main() {
	int n, a, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> a;
		if (IsPrime(a)) { ans++; }
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3088
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))

    appeared = set()
    dup = 0

    for x in a:
        if x in appeared:
            dup = x
            break
        else:
            appeared.add(x)

    first = a.index(dup)
    second = a[first + 1:].index(dup) + first + 1

    print(n)

    p = first
    q = (n + 1) - second - 1

    c1 = n + 1
    c2 = 1

    for i in range(2, n + 2):
        c1 *= (n + 1 - (i - 1))
        c1 %= MOD
        c1 *= pow(i, MOD - 2, MOD)
        c1 %= MOD
        c2 *= (p + q - (i - 2))
        c2 %= MOD
        c2 *= pow(i - 1, MOD - 2, MOD)
        c2 %= MOD
        print((c1 - c2) % MOD)


if __name__ == '__main__':
    main()


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

using namespace std;

const int MAX_N = 105;
const int MAX_V = 100005;

struct Iterm {
  long long weight;
  int value;
};

int n, w;

Iterm arr[MAX_N];

long long dp[2][MAX_V];

int main() {
  scanf("%d %d", &n, &w);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", &arr[i].weight, &arr[i].value);
  }
  int t = 0;
  long long ans = 0;
  for (int i = 0; i < MAX_V; ++i) {
    dp[0][i] = dp[1][i] = LLONG_MAX / 3;
  }
  dp[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    t = 1 - t;
    for (int j = 0; j <= MAX_V - 5; ++j) {
      dp[t][j] = dp[1 - t][j];
      if (arr[i].value <= j) {
        dp[t][j] = min(dp[1 - t][j], dp[1 - t][j - arr[i].value] + arr[i].weight);
      }
      if (dp[t][j] <= w) {
        ans = max(ans, (long long) j);
      }
    }
  }
  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 1792
import heapq
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

if sum(A) < sum(B):
    print(-1)
    exit()

h = []
heapq.heapify(h)  # リストaのheap化

ans = 0
d = 0
for a, b in zip(A, B):
    if a >= b:
        heapq.heappush(h, -(a-b))
    else:
        ans += 1
        d += b-a

while d > 0:
    ans += 1
    d += heapq.heappop(h)

print(ans)


Measured memory_bytes: 84528
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString, putStrLn)
import Prelude hiding (words, getLine, putStrLn, unwords, readLn, print)

import Control.Monad (replicateM)
import Data.List (foldl')
import Data.Maybe (isJust)


class (Read a, Show a) => CPString a where
  cpRead :: String -> a
  cpShow :: a -> ByteString
  cpRead = read
  cpShow = BS.pack . show
instance CPString ByteString where
  cpRead = BS.pack
  cpShow = id
instance CPString String where
  cpRead = id
  cpShow = BS.pack
instance CPString Char where
  cpRead [a] = a
  cpShow = BS.pack . pure
instance CPString Int
instance CPString Integer
instance CPString Float
instance CPString Double
instance CPString Rational
instance CPString a => CPString [a]

readLine :: CPString a => IO [a]
readLine = fmap (cpRead . BS.unpack) . BS.words <$> BS.getLine

printLn :: CPString a => a -> IO ()
printLn = putStrLn . cpShow

main :: IO ()
main = do
  [n] <- readLine @Int
  printLn $ fBSum n

fBSum :: Int -> Int
fBSum n = sum $ map notFB [1..n]

notFB :: Int -> Int
notFB n
  | n `mod` 3 == 0 = 0
  | n `mod` 5 == 0 = 0
  | otherwise = n

Measured memory_bytes: 4008
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if A > B:
    x = A
    A = B
    B = x
if V <= W:
    ans="NO"
elif T*V+A-B >= T*W:
    ans="YES"
else:
    ans="NO"
print(ans)

Measured memory_bytes: 9192
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r;
    cin >> r;
    cout << r*r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    long a = (long)sqrt(n+0.0000001);
    printf("%ld\n", a*a);
 
    return 0;
}


Measured memory_bytes: 128
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

//累乗 O(log N)
long long power(long long x, long long N){
	if(N == 0) return 1LL;
	if(N == 1) return x;
	long long tmp = power(x, N/2);
	if(N%2 == 0) return tmp * tmp % MOD;
	else return tmp * tmp % MOD * x % MOD;
}

//逆元 O(log x)
long long inverse(long long x){
	return power(x, MOD-2);
}

int N;
ll A[10000];
ll so[1000000] ={};
signed main(){
	cin >> N;
	rep(i, N) cin >> A[i];

	rep(i, N){
		ll a = A[i];
		for(ll j=2; j<=sqrt(A[i]); j++){
			ll c = 0;
			while(a%j == 0){
				c++;
				a /= j;
			}
			so[j] = max(so[j], c);
		}
		if(a > 1){
			so[a] = max(so[a], 1LL);
		}
	}

	ll sum = 1;
	for(ll i=2; i<1000000; i++){
		rep(j, so[i]){
			sum *= i;
			sum %= MOD;
		}
	}

	ll ans = 0;
	rep(i, N){
		ans += sum * inverse(A[i]);
		ans %= MOD;
	}
	cout << ans << endl;
}


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

int N;

int main () {
  cin >> N;

  int ans = 0;
  rep(i,N) {
    int a;
    cin >> a;
    while(a % 2 == 0) {
      a /= 2;
      ans++;
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long int ll;
typedef unsigned long long int ull;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  string s,t="bust";
  cin >>a>>b>>c;
  if(a+b+c<22)t="win";
  cout <<t;
}

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

int main() {
    int P,Q,R;
    cin >> P >> Q >> R;
    if(P + Q < Q+R){
      if(P+R < P+Q){ cout << (P+R) << endl;}else{
        cout << (P+Q) << endl;
      }
    }else if(Q+R < P+R){
      cout << (Q+R) << endl;
    }else{cout << (P+R) << endl;}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for (int i = 0; i <= K; i++) {
			for (int j = 0; j <= K; j++) {
				int Z = S - i - j;
				if (Z >= 0 && Z <= K) {
					ans++;
				}
			}
		}
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 23124
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {
  int n, k;
  cin >> n >> k;
  long long int cnt = 0;

  for(int b=1; b<=n; b++){
    long long int tmp = 0;

    tmp += max(0, b-k) * (n / b);
    tmp += max(0, n%b - k + 1);
    cnt += tmp;
  }
  for(int b=1; b<=n; b++){
    if(0%b >= k) cnt--;
  }
  cout << cnt << endl;

  return 0;
}


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

const int maxn(2e5 + 5);
const int mod(1e9 + 7);

int n, c[maxn], f[maxn], lst[maxn], pre[maxn];

int main() {
	int i;
	scanf("%d", &n);
	for (i = 1; i <= n; ++i) scanf("%d", &c[i]), lst[i] = pre[c[i]], pre[c[i]] = i;
	for (f[0] = i = 1; i <= n; ++i) {
		f[i] = f[i - 1];
		if (lst[i] && lst[i] != i - 1) (f[i] += f[lst[i]]) %= mod;
	}
	printf("%d\n", f[n]);
	return 0;
}

Measured memory_bytes: 3328
n,k=map(int,input().split())
xy=[list(map(int,input().split())) for _ in range(n)]
x=[t[0] for t in xy]
y=[t[1] for t in xy]

res=[]
for i in range(n-1):
    for j in range(i+1,n):
        for a in range(n-1):
            for b in range(a+1,n):
                l=min(x[i],x[j])
                r=max(x[i],x[j])
                d=min(y[a],y[b])
                u=max(y[a],y[b])
                tk=0
                for t in xy:
                    if l<=t[0]<=r and d<=t[1]<=u:
                        tk+=1
                if tk>=k:
                    res.append((r-l)*(u-d))
print(min(res))

Measured memory_bytes: 113764
from collections import defaultdict
from collections import OrderedDict
n = int(input())
answer = dict()
for _ in range(n):
    z = str(input())
    if z in answer:
        answer[z]+=1
    else:
        answer.update({z:1})
groupedByValue = defaultdict(list)
for key, value in sorted(answer.items()):
    groupedByValue[value].append(key)
M = groupedByValue[max(groupedByValue)]
for i in M:
    print(i)

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

int main()
{
    int a,b,res;
    cin >> a >> b;
    int c = a+b;
    if(c&1) res = (a+b)/2 + 1;
    else res = (a+b)/2;
    cout << res << endl;
    return 0;
}


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

using namespace std;

int i,j,n,m;
char a[55][55],b[55][55];

int main(){
	scanf("%d%d", &n, &m);
	
	for(i = 0; i < n; i++)
	scanf("%s", a[i]);
	
	for(i = 0; i < m; i++)
	scanf("%s", b[i]);
	
	for(i = 0; i < n - m + 1; i++){
		for(j = 0; j < n - m + 1; j++){
			bool flag = 1;
			for(int ii = 0; ii < m; ii++){
				for(int jj = 0; jj < m; jj++)
				flag &= (a[i + ii][j + jj] == b[ii][jj]);
			}	
			
			if(flag)
			return 0 * printf("Yes\n");
		}
	}
	printf("No\n");
}


Measured memory_bytes: 256
import java.util.*;

//Circle in a Rectangle
public class Main {
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String[] input = sc.nextLine().split(" ");
		int W = Integer.parseInt(input[0]);
		int H = Integer.parseInt(input[1]);
		int x = Integer.parseInt(input[2]);
		int y = Integer.parseInt(input[3]);
		int r = Integer.parseInt(input[4]);
		String str;
		if(x <= 0 || x >= W || y <= 0 || y>=H )
		{
			//Circle is over
			str = "No";
		}
		else
		{
			if(x + r > W || x - r < 0 || y + r > H || y - r < 0)
			{
				str = "No";
			}
			else
			{
				str = "Yes";
			}
		}
		System.out.println(str);
		sc.close();
	}
}



Measured memory_bytes: 26340
n = int(input())
gem_value = list(map(int, input().split(' ')))
gem_cost = list(map(int, input().split(' ')))
max_value = 0

for i in range(n):
  if gem_value[i] > gem_cost[i]:
    max_value += gem_value[i] - gem_cost[i]

print(max_value)

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        boolean can=true;
        int i=1;
        while(can){
            int x=sc.nextInt();
            if(x!=0){
                System.out.println("Case"+" "+i+":"+" "+x);
                i++;
            }
            else can=false;
        }
    }
}


Measured memory_bytes: 42636
#include <iostream>
#include <vector>
#include <cstdio>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 150005;

vector<int> G[MAX_N];
double dp1[MAX_N], dp2[MAX_N];

void dfs(int u, int p)
{
    each(v,G[u]){
        if(v != p){
            dfs(v, u);
            dp1[u] += dp1[v] + 1;
        }
    }
    if(u == 0){
        dp1[u] /= (double)G[u].size();
    }else if(len(G[u]) > 1){
        dp1[u] /= (double)G[u].size() - 1;
    }
}

void redfs(int u, int p)
{
    if(p > 0){
        dp2[u] = (dp1[p]*((double)G[p].size()-1)-dp1[u]-1+dp2[p])/((double)G[p].size()-1) + 1;
    }else if(p == 0){
        if(len(G[p]) == 1){
            dp2[u] = 1;
        }else{
            dp2[u] = (dp1[p]*(double)G[p].size()-dp1[u]-1)/((double)G[p].size()-1) + 1;
        }
    }
    each(v, G[u]){
        if(v != p){
            redfs(v, u);
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n-1){
        int u,v;
        cin >> u >> v;
        G[u-1].pb(v-1), G[v-1].pb(u-1);
    }
    dfs(0, -1);
    redfs(0, -1);
    rep(i,n){
        if(i == 0){
            printf("%.12lf\n", dp1[i]);
        }else{
            printf("%.12lf\n", (dp1[i]*(G[i].size()-1)+dp2[i])/G[i].size());
        }
    }
    return 0;
}

Measured memory_bytes: 16512
#include <iostream>
#include <algorithm>
#include <string>;

using namespace std;

int main()
{
  string s;
  int a,b,c;
  a = b = c = 0;

  cin >> s;

  for ( int i = 0; i < s.size(); ++i ) {
    if ( s[i] == 'a' ) ++a;
    if ( s[i] == 'b' ) ++b;
    if ( s[i] == 'c' ) ++c;
  }

  if ( a == 1 && b == 1 && c == 1 ) cout << "Yes\n";
  else cout << "No\n";
}


Measured memory_bytes: 888
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;

int main(){
    int a,b; char op;
    int r = 0;
    while(cin >> a >> op >> b){
        switch(op){
        case '+': r = a + b; break;
        case '-': r = a - b; break;
        case '*': r = a * b; break;
        case '/': r = a / b; break;
        case '?': return 0;
        }
        cout << r << endl;
    }

    return 0;
}

Measured memory_bytes: 1164
//https://atcoder.jp/contests/abc079/tasks/abc079_d
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll H,W; cin>>H>>W;
    vector<vector<ll>> cij(10,vector<ll>(10));
    vector<vector<ll>> d(10,vector<ll>(10, INT64_MAX)); //warshall_floyd
    REP(y,10){
        REP(x,10){
            ll c; cin>>c;
            cij[y][x]=c;
            auto from = y;
            auto to = x;
            d[from][to]=c;
        }
    }
    vector<vector<ll>> ahw(H,vector<ll>(W));
    for(auto&& ah:ahw){
        for(auto&& a:ah){
            cin>>a;
        }
    }

    auto warshall_floyd = [&](int n) //nは頂点数
    {
	    for(int i = 0; i < n; i++) // 経由する頂点
		    for(int j = 0; j < n; j++) // 開始頂点
			    for(int k = 0; k < n; k++) // 終端
				    d[j][k] = std::min(d[j][k], d[j][i] + d[i][k]);
    };
	warshall_floyd(10); //O(n^3)

    ll ans = 0;
    for(const auto& ah:ahw){
        for(const auto& a:ah){
            if (a!=-1){
                ans += d[a][1];
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;


int main() {
    int N;
    string S, T;
    cin >> N >> S >> T;
    string ans;
    rep(i, N) {
        ans = ans + S.at(i) + T.at(i);          
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P  = pair<int, int>;
int main() {
    int x;
    cin >> x;
    for (int i = 1; i <= 360; ++i) {
        if (i * x % 360 == 0) return cout << i, 0;
    }
    return 0;
}


Measured memory_bytes: 3544
#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;

int main() {
    int N,M; cin >> N >> M;
    vector<vector<int>> G(N,vector<int>());
    REP(i,M){
        int u,v; cin >> u >> v;
        u--;
        v--;
        G[u].push_back(v);
    }

    int S,T; cin >> S >> T;
    S--;
    T--;

    vector<vector<int>> dist(N,vector<int>(3,-1));

    queue<pair<int,int>> q;
    q.push({S,0});

    dist[S][0] = 0;

    while(!q.empty()){
        auto p = q.front(); q.pop();
        int pos = p.first;
        int cnt = p.second;

        int n_cnt = (cnt+1)%3;

        for(auto next: G[pos]){
            if(dist[next][n_cnt] != -1) continue;

            dist[next][n_cnt] = dist[pos][cnt] + 1;
            q.push({next, n_cnt});
        }
    }

    if(dist[T][0] == -1) cout << -1 << endl;
    else cout << dist[T][0]/3 << endl;




    return 0;
}

Measured memory_bytes: 13896
#include "bits/stdc++.h"

typedef long long ll;
using namespace std;

bool compare(tuple<int, string, int> a, tuple<int, string, int> b) {
    string s = get<1>(a);
    if (get<1>(a) != get<1>(b)) {
        return get<1>(a) < get<1>(b);
    } else {
        return get<2>(a) > get<2>(b);
    }
}

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

    auto solve1 = [&] {
        vector<tuple<int, string, int>> res(n);
        for (int i = 0; i < n; ++i) {
            string s;
            int p;
            cin >> s >> p;
            res[i] = make_tuple(i + 1, s, p);
        }
        sort(res.begin(), res.end(), compare);

        for (int i = 0; i < n; ++i) {
            cout << get<0>(res[i]) << endl;
        }
    };

    auto solve2 = [&] {
        vector<pair<pair<string, int>, int>> res(n);
        for (int i = 0; i < n; ++i) {
            string s;
            int p;
            cin >> s >> p;
            res[i] = make_pair(make_pair(s, p * -1), i + 1);
        }
        sort(res.begin(), res.end());

        for (int i = 0; i < n; ++i) {
            cout << res[i].second << endl;
        }
    };

    solve2();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;

int main() {
  ll n, m;
  scanf("%lld %lld", &n, &m);

  vector<ll> x(m);
  for (ll i = 0; i < m; i++) {
    ll v;
    scanf("%lld", &v);
    x[i] = v;
  }

  sort(x.begin(), x.end());

  vector<ll> s;
  for (ll i = 0; i < m; i++) {
    if (i >= 1) {
      s.emplace_back(x[i] - x[i - 1]);
    }
  }

  ll ans = 0;
  sort(s.rbegin(), s.rend());

  for (ll i = 0; i < s.size(); i++) {
    if (i < n - 1) {
      continue;
    }
    ans += s[i];
  }
  cout << ans << endl;
}


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

int n;
vector<int> w(300);
vector<vector<int>> dp(301, vector<int>(301, -1));


int rec(int l,int r){
    //既に計算済み？
    if(dp[l][r] != -1) return dp[l][r];

    //これ以上取り除けない？
    if(abs(l - r) <= 1) return 0;

    int res = 0;
    //パターン1.
    if(abs(w[l] - w[r - 1]) <= 1 && rec(l + 1,r - 1) == r - l - 2)
    {
        //[l , r)がはじき出せるので
        res = r - l;
    }

    //パターン２.区間を分ける
    for(int mid = l + 1;mid <= r - 1;mid++)
    {
        res = max(res , rec(l,mid) + rec(mid,r));
    }
    return dp[l][r] = res;
};

int main()
{
    while (true)
    {
        cin >> n;
        if (n==0) break;
        for (int i=0; i<n; i++) cin >> w[i];
        int answer = rec(0, n);
        cout << answer << endl;
        for (int i=0; i<301; i++)
        {
            for (int j=0; j<301; j++)
            {
                dp[i][j]=-1;
            }
        }
    }
}



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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int a, b; cin >> a >> b;
	string one;
	string two;
	for (int i = 0; i < a; ++i) {
		one += '0' + b;
	}
	for (int i = 0; i < b; ++i) {
		two += '0' + a;
	}
	cout << min(one, two);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

ll gcd(ll a, ll b)
{
    if (!b)
        return a;
    return gcd(b, a % b);
}

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

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/


int main()
{
    start();
    int n;
    cin>>n;
    int c=1;
    int ans=0;

    for (int i=1;i<=n;i*=2)
    {
        ans=i;
        c++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3620
N = int(input())
A = [int(x) for x in input().split()]
rate = [0] * 8
rate_big = 0
for i in range(N):
    if A[i] < 3200:
        rate[A[i] // 400] += 1
    else:
        rate_big += 1
ans_min = 0
ans_max = 0
for j in range(8):
    if rate[j] > 0:
        ans_min += 1
if ans_min == 0:
    ans_min = 1
    ans_max = rate_big
else:
    ans_max = ans_min+rate_big
print(ans_min, ans_max, sep=" ")


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

template<class T>
ostream& operator<< (ostream& fout, const vector<T>& vec) {
  for (const auto& el : vec) {
    fout << el << ' ';
  }
  return fout;
}

template <class T>
istream& operator>> (istream& fin, vector<T>& vec) {
  for (size_t i = 0; i < vec.size(); ++i) {
    cin >> vec[i];
  }
  return fin;
}

int64_t Solve() {
  int64_t h, w, n;
  set<pair<int64_t, int>> used;
  cin >> h >> w >> n;
  vector<int64_t> counters(11);
  counters[0] = (h - 3 + 1) * (w - 3 + 1);
  for (int64_t i = 0; i < n; ++i) {
    int64_t a, b;
    cin >> a >> b;
    --a; --b;
    used.insert({a, b});
    for (int64_t dx = -1; dx <= 1; ++dx) {
      for (int64_t dy = -1; dy <= 1; ++dy) {
        int64_t cc = 0;
        for (int64_t x = -1; x <= 1; ++x) {
          for (int64_t y = -1; y <= 1; ++y) {
            if (a + x + dx < 0 || a + x + dx >= h || b + y + dy < 0 || b + y + dy >= w) goto f1;
            if (used.find({a + x + dx, b + y + dy}) != used.end()) {
              ++cc;
            }
          }
        }
        for (int64_t c = 0; c <= 10; ++c) {
          if (cc == c) {
            --counters[c - 1];
            ++counters[c];
          }
        }
f1: ;
      }
    }
  }
  for (int64_t i = 0; i < 10; ++i) {
    cout << counters[i] << '\n';
  }
  return 0;
}


int main() {
#ifndef LOCAL
  //freopen("input.txt", "rt", stdin);
  //freopen("output.txt", "wt", stdout);
#endif
#ifdef LOCAL
  //freopen("input.txt", "rt", stdin);
#endif

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Solve();
  return 0;
}


Measured memory_bytes: 6528
using System;

namespace C_sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine();

            var r = double.Parse(line);
            
            var area = Math.PI * r * r;
            var circum = 2 * Math.PI * r;

            Console.WriteLine($"{area} {circum}");
        }
    }
}



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

int main(void){
	char S[1001];
  unsigned n=0,w=0,s=0,e=0,i;
  scanf("%s%*c",S);
  for(i=0;i<sizeof(S);i++){
    switch(S[i]){
    	case 'N':
      	n++;
      	break;
      case 'S':
      	s++;
        break;
      case 'W':
       w++;
       break;
      case 'E':
      	e++;
        break;
    }
  }
  if(((n==0 && s==0) || (n>0 && s>0)) && ((w==0 && e==0) || (w>0 && e>0))){
 	 puts("Yes");
  }else{
  	puts("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main() {
string s;
cin>>s;
int cnt=0;
int ans=0;
for(int i=0; i<s.size(); i++)
{
if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T') {
    ++cnt;
    ans = max(ans, cnt);
}else{
ans =max(ans,cnt);
cnt=0;
}
}
cout<<ans<<endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  codeforces 1
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define int long long
#define N 1500002
using namespace std;
signed main() {
    int k;
    cin>>k;
    int r=7;
    int count=0;
    for(int i=0;i<1000000;i++) {
        if(r%k==0) {
            count++;
            break;
        }
        else {
            count++;
            r=(r%k)*10+7;
        }
    }
    if(count==1000000) {
        cout<<-1<<endl;
    }
    else {
        cout<<count<<endl;
    }
    return 0;
}


Measured memory_bytes: 3628