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

public class Main {
    public static void main(String...args){
        Scanner sc= new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int found= 0;
        for(int i=2; i<N;i++){
            String check3 = Character.toString(S.charAt(i));
            String check2 = Character.toString(S.charAt(i-1));
            String check1 = Character.toString(S.charAt(i-2));
            if(check1.equals("A") && check2.equals("B") && check3.equals("C")){
                found++;
            }
        }
        System.out.println(found);
    }
}


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

using namespace std;

int main(void)
{
    int N;
    set<string> prise;
    int count = 0;


    cin >> N;
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        
        if(prise.find(s)==prise.end()){
            prise.insert(s);
        }
    }
    cout << prise.size() << endl;


        return 0;
}


Measured memory_bytes: 19196
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int ans=0;
  if(c<=a&&b<=d){
    cout<<(b-a);
    return 0;
  }
  if(c>=a&&b>=d){
    cout<<(d-c);
    return 0;
  }
  if(a<=c&&c<=b){
    cout<<(b-c);
    return 0;
  }
  if(c<=a&&a<=d){
    cout<<(d-a);
    return 0;
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  [n, m] <- readInts
  pm <- replicateM n getLine
  qm <- replicateM m getLine
  putStrLn $ if solve n m pm qm then "Yes" else "No"

solve :: Int -> Int -> [String] -> [String] -> Bool
solve n m pm qm = not . null $ do
  x <- [0..n-m]
  y <- [0..n-m]
  let rm = map (take m . drop y) $ take m $ drop x pm
  if rm == qm then [rm] else []

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"



Measured memory_bytes: 892
#include <cstdio>
#include <iostream>
#include <vector>
#include <complex>
#include <utility>
#include <queue>
using namespace std;
using F = double;
using P = complex<F>;
using L = pair<P,P>;
#define X real()
#define Y imag()
const F EPS = 1e-8, INF = 1e10;

F dot(const P &A, const P &B){ return A.X*B.X+A.Y*B.Y; }
F cross(const P &A, const P &B){ return A.X*B.Y-A.Y*B.X; }

int ccw(P a, P b, P c){
  b -= a; c -= a;
  if(cross(b,c) > EPS) return +1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return +2;
  if(norm(b) < norm(c)-EPS) return -2;
  return 0;
}

bool is_cross(L a, L b){
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return (ccw(af,as,bf)*ccw(af,as,bs) <= 0) and (ccw(bf,bs,af)*ccw(bf,bs,as) <= 0);
}

F solve(const vector<P> &Ps, L l, int s, int t){
  int n = Ps.size();
  vector<F> D(n,INF);
  priority_queue<pair<F,int>> q;
  q.emplace(0,s);
  while(not q.empty()){
    int v = q.top().second;
    F c = -q.top().first;
    q.pop();
    if(D[v] < c-EPS) continue;
    D[v] = c;
    for(int i = 0; i < n; ++i){
      if(i == v) continue;
      if(is_cross(l,L(Ps[i],Ps[v]))){
        continue;
      }
      F c_ = c + abs(Ps[i]-Ps[v]);
      if(D[i] < c_ - EPS) continue;
      D[i] = c_;
      q.emplace(-c_,i);
    }
  }
  return D[t];
}

int main(){
  int A, B;
  cin >> A >> B;
  vector<P> PA, PB;
  for(int i = 0; i < A; ++i){
    F x, y;
    cin >> x >> y;
    PA.emplace_back(x,y);
  }
  for(int i = 0; i < B; ++i){
    F x, y;
    cin >> x >> y;
    PB.emplace_back(x,y);
  }
  F ans = solve(PA,L(PB[0],PB[1]),0,1) + abs(PB[0]-PB[1]);
  //fprintf(stderr,"%.12f\n",ans);
  ans = min(ans,solve(PB,L(PA[0],PA[1]),0,1)+abs(PA[0]-PA[1]));
  if(ans > INF-EPS){
    cout << -1 << endl;
    return 0;
  }
  printf("%.12f\n",ans);
}



Measured memory_bytes: 3348
def bsearch(mn, mx, func):
    #func(i)=False を満たす最大のi (mn<=i<mx)
    idx = (mx + mn)//2
    while mx-mn>1:
        if func(idx):
            idx, mx = (idx + mn)//2, idx
            continue
        idx, mn = (idx + mx)//2, idx
    return idx
def prime_decomposition(n):                                                                                            
    i = 2
    table = []                
    while i * i <= n:                                       
        c = 0                          
        while n % i == 0:              
            n /= i                          
            c+=1                                 
        if c!=0:                                                     
            table.append((i,c))                  
        i += 1                                
    if n > 1:                                  
        table.append((int(n), 1))                                                                                     
    return table

N = int(input())
X = prime_decomposition(N)
R = 0
for a, b in X:
    R += bsearch(-1, 10**18, lambda x : x*(x+1)//2>b)
print(R)


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

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n), b(n), c(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	for(int i = 0; i < n; ++i){ cin >> b[i]; }
	for(int i = 0; i < n; ++i){ cin >> c[i]; }
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	vector<ll> ab(n);
	for(int i = 0; i < n; ++i){
		ab[i] = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
	}
	vector<ll> integral_ab(n + 1);
	for(int i = 0; i < n; ++i){
		integral_ab[i + 1] = integral_ab[i] + ab[i];
	}
	ll answer = 0;
	for(int i = 0; i < n; ++i){
		const int k = lower_bound(b.begin(), b.end(), c[i]) - b.begin();
		answer += integral_ab[k];
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 4224
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int fn(int a[][100],int x,int y,int p,int w,int h){
  if(0){
  }else if(a[x][y]==-2){
    a[x][y]=p+1;
  }else if(a[x][y]==-1){
    if(x==0||x==w-1||y==0||y==h-1)
      return 1;
    a[x][y]=p;
    if(0||
       fn(a,x-1,y,p,w,h)||
       fn(a,x,y-1,p,w,h)||
       fn(a,x+1,y,p,w,h)||
       fn(a,x,y+1,p,w,h))
      return 1;
  }
  return 0;
}
int fm(int a[][100],int x,int y,int p,int w,int h){
  if(0){
  }else if(a[x][y]==-2){
    if(x==0||x==w-1||y==0||y==h-1)
      return 1;
    a[x][y]=p;
    if(0||
       fm(a,x-1,y,p,w,h)||
       fm(a,x,y-1,p,w,h)||
       fm(a,x+1,y,p,w,h)||
       fm(a,x,y+1,p,w,h))
      return 1;
  }
  return 0;
}
int main(){
  int i,j,k;
  int a[100][100],w,h;
  char c;
  while(cin>>w>>h&&w+h){
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	cin>>c;
	if(0){
	}else if(c=='#'){
	  a[j][i]=-2;
	}else if(c=='.'){
	  a[j][i]=-1;
	}else if(c=='&'){
	  a[j][i]=0;
	}
      }
    }
    for(i=0;;){
      for(j=0;j<h;j++){
	for(k=0;k<w;k++){
	  if(a[k][j]==i){
	    if(k==0||k==w-1||j==0||j==h-1)
	      break;
	    if(0||
	       fn(a,k-1,j,i,w,h)||
	       fn(a,k,j-1,i,w,h)||
	       fn(a,k+1,j,i,w,h)||
	       fn(a,k,j+1,i,w,h))
	      break;
	  }
	}
	if(k!=w)
	  break;
      }
      if(j!=h)
	break;
      i++;
      for(j=0;j<h;j++){
	for(k=0;k<w;k++){
	  if(a[k][j]==i){
	    if(k==0||k==w-1||j==0||j==h-1)
	      break;
	    if(0||
	       fm(a,k-1,j,i,w,h)||
	       fm(a,k,j-1,i,w,h)||
	       fm(a,k+1,j,i,w,h)||
	       fm(a,k,j+1,i,w,h))
	      break;
	  }
	}
	if(k!=w)
	  break;
      }
      if(j!=h)
	break;
    }
    cout<<i<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <iterator>
#include <tuple>
using namespace std;
using ll = long long;

int main()
{
  string s;
  cin >> s;
  map<int, char> num;
  for (int i = 0; i < s.size(); ++i)
  {
    num[s[i]] = 1;
  }
  cout << (num['N'] == num['S'] && num['W'] == num['E'] ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
N, L = gets.split.map(&:to_i)

apples = []
N.times do | i |
  apples << L + i+1 - 1
end

unless apples.include? 0
  if apples[0] > 0
    apples.shift
  else
    apples.pop
  end
end

sum = 0; apples.each{ |a|  sum+= a }
puts sum

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    i64 N;
    cin >> N;

    vector<i64> A(N);
    rep(i,0,N) cin >> A[i];

    sort(begin(A),end(A));

    i64 ans=0;

    unordered_map<i64,vector<i64>> mp;
    rep(i,0,N){
        mp[A[i]].push_back(i);
    }

    vector<i64> del(N);
    for(i64 i=N-1; i>=0; --i){
        if(del[i]) continue;
        rep(j,0,32){
            i64 s=1LL<<j;
            if(mp.find(s-A[i])==mp.end()) continue;
            auto it=mp.find(s-A[i]);
            while(it->second.size() and it->second.back()>=i) it->second.pop_back();
            if(it->second.size()==0) continue;
            print(i);
            print(it->second.back());
            del[i]=del[it->second.back()]=true;
            it->second.pop_back();
            ++ans;
        }
    }

    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

int main() {
  int n; cin>>n; bool ap = true;
  for(int i=0;i<n&&ap;i++) {
    int a; cin>>a;
    if (a%2==0) {
      if (a%3==0 || a%5==0) continue;
      else ap=false;
    }
  }
  if (ap) cout<<"APPROVED"<<endl;
  else cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict
N = int(input())
S = [input() for _ in range(N)]
dic = defaultdict(int)
for i in range(N):
        dic[S[i]] += 1
dic = dict(dic)
dic = sorted(dic.items(),key = lambda x:-x[1])
n = len(dic)
max = dic[0][1]
d = 0
for i in range(n):
  if dic[i][1] == max:
    d += 1
  else:
    d = i
    break
dic = sorted(dic[0:d],key = lambda x:x[0])
for i in range(len(dic)):
  print(dic[i][0])

Measured memory_bytes: 45028
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int main(){
	int m,n;
	std::cin >> n>>m;
	std::cout <<int( m*pow(m-1,n-1)) << std::endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

// 最大公約数を求める(ユークリッドの互除法).
ll gcd (ll x, ll y) {
  if (y > x) swap(x,y);
  if (y == 0) return x;
  return gcd(x%y,y);
}


int main() {
  ll n,m;
  cin >> n >> m;
  if (m % n == 0) {
    cout << m / n << endl;
    return 0;
  }
  ll mmax = m / n, b = mmax + (m % n);
  ll ans = 1;
  for (ll i = 2; i < mmax; ++i) {
    if (m % i != 0) {
      continue;
    }

    ll tmp = i * (n-1);
    ll tt = m - tmp;
    if (tt > 0 and tt % i == 0) {
      ans = max(ans, i);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
N=int(input())
p=[0]
q=[0]
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
for i in range(N):
  p.append(p[i]+A1[i])
  q.append(q[i]+A2[N-i-1])
ans=0
for j in range(N):
  ans=max(ans,p[j+1]+q[N-j])
print(ans)

Measured memory_bytes: 9144
a = [1,2,3,4,5,6,7,8,9,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000]
import heapq
heapq.heapify(a)
cnt = 18
c = 1
while True:
  if cnt > 10**5:
    break
  for i in a:
    if len(str(i)) == c:
      m = i//10**(c-1)
      if i//10**(c-1) == 1:
        heapq.heappush(a,i+10**c*(i//10**(c-1)))
        heapq.heappush(a,i+10**c*(i//10**(c-1)+1))
        cnt += 2
        for j in range(10-c):
          heapq.heappush(a,i+10**c*(10**(j+1)))
          cnt += 1
      elif i//10**(c-1) == 9:
        heapq.heappush(a,i+10**c*(i//10**(c-1)-1))
        heapq.heappush(a,i+10**c*(i//10**(c-1)))
        cnt += 2
      else:
        heapq.heappush(a,i+10**c*(i//10**(c-1)-1))
        heapq.heappush(a,i+10**c*(i//10**(c-1)))
        heapq.heappush(a,i+10**c*(i//10**(c-1)+1))
        cnt += 3
  c += 1

k = int(input())
#a = set(a)
#a = list(a)
for i in range(k-1):
  heapq.heappop(a)
print(heapq.heappop(a))

Measured memory_bytes: 12352
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,n) for (int i=1;i<=n;i++)
long long io1[200005],io2[200005];
int main()
{
    long long now,n,m;
    long long all=0;
    cin>>n>>m;
    cin>>now;
    now--;
    for (long long i=2;i<=n;i++)
    {
    	long long to;
    	cin>>to;
    	to--;
    	now%=m;
    	if (now>to) to+=m;
    	all+=to-now;
    	io1[now+1]++;
    	io1[to+1]--;
    	io2[now+1]+=now;
    	io2[to+1]-=now;
    	now=to;
    }
    for (long long i=1;i<2*m;i++)
    {
    	io1[i]+=io1[i-1];
    	io2[i]+=io2[i-1];
    }
    long long ret=all;
    for (long long i=0;i<m;i++)
    {
    	long long nxt=all;
    	long long a=io1[i],b=io2[i];
    	nxt-=i*a-b-a;
    	a=io1[i+m];b=io2[i+m];
    	nxt-=(i+m)*a-b-a;
    	if (nxt<ret) ret=nxt;
    }
    cout<<ret;
}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;

	for (LL i = 1; i <= 9; ++i)
	{
		if (N % i == 0 && N / i <= 9)
		{
			out << "Yes" << std::endl;
			return 0;
		}
	}
	out << "No" << std::endl;
}


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

using namespace std;
 
        int main()   {
            int h,w;
            cin>>h>>w;
            char str[h+2][w+2];
            for (int i=0;i<h+2;i++)   {
                for (int j=0;j<w+2;j++)   {
                    str[i][j]='#';
                }
            }
            
            for (int i=1;i<h+1;i++)   {
                for (int j=1;j<w+1;j++)   {
                    cin>>str[i][j];
                }
            }
            for (int i=0;i<h+2;i++)   {
                for (int j=0;j<w+2;j++)   {
                    cout<<str[i][j];
                }
                cout<<"\n";
            }
            
            
        }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

struct UnionFind{
	vl p;
	vl rank;
	vl cnt;

	UnionFind(ll n){
		rank.resize(n,0);
		p.resize(n,0);
		cnt.resize(n,0);
		rep(i,n){
			p[i] = i;
			rank[i] = 0;
			cnt[i] = 1;
		}
	}

	ll find(ll x){
		if(x != p[x]) p[x] = find(p[x]);
		return p[x];
	}

	bool same(ll x, ll y){
		return find(x) == find(y);
	}

	void unite(ll x, ll y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(rank[x] > rank[y]){
			p[y] = x;
			cnt[x] += cnt[y];
		}else{
			p[x] = y;
			cnt[y] += cnt[x];
			if(rank[x] == rank[y]) rank[y]++;
		}
	}

	ll size(ll x){
		return cnt[find(x)];
	}
};

bool in(ll y, ll x, ll h, ll w){
	return 0 <= y && y < h && 0 <= x && x < w;
}
ll h,w;
vs s(505);

int main(){
	cin >> h >> w;
	rep(i,h) cin >> s[i];
	UnionFind uf(h*w);
	rep(i,h){
		rep(j,w){
			rep(k,4){
				ll ny = i + dy[k];
				ll nx = j + dx[k];
				if(in(ny,nx,h,w) && s[i][j] != s[ny][nx]){
					uf.unite(i*w+j, ny*w+nx);
				}
			}
		}
	}
	vpl v(h*w,P(0,0));
	rep(i,h){
		rep(j,w){
			if(s[i][j] == '#'){
				v[uf.find(i*w+j)].first++;
			}else{
				v[uf.find(i*w+j)].second++;
			}
		}
	}
	ll ans = 0;
	rep(i,h*w) ans += v[i].first * v[i].second;
	cout << ans << endl;
}

Measured memory_bytes: 6784
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;

class _Class
{
  void _Do()
  {
    var NK = Split.ints();
    var N = NK[0];
    int K = NK[1];
    var h = Split.ints();

    var dp = new int[N];

    // 0,1,
    for(int i=0;i<N ;i++ )
    {
      // 1,2,
      for (int k = 1; k <= K; k ++)
      {
        // i-1,i-2,
        if (i-k<0)
          break;

        // 
        int iii = Math.Abs(h[i] - h[i - k]) + dp[i - k];

        //
        if (k == 1)
          //
          dp[i]= iii;
        else
          // 小さい方
          dp[i] = Math.Min(iii,dp[i]);
      }
    }

    Console.WriteLine(dp[N-1]);
  }

  static void Main(string[] args)
  {
    _(args);
    new _Class()._Do();
  }

  [Conditional("DEBUG")]
  static void _(string[] args)
  {
    if (args.Length != 0 && File.Exists(args[0]))
      Console.SetIn(new StreamReader(args[0]));
    else
      Console.Error.WriteLine("in");
  }
}

static class Split
{ 

  // 1
  public static string[] strings()
  {
    return Console.ReadLine().Split();
  }


  // [2.1] -2,147,483,648 ~ +2,147,483,647
  public static int[] ints()
  {
    var _s = Console.ReadLine().Split();

    var x = new int[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = int.Parse(_s[i]);

    return x;
  }

  // [2.2] 
  // -9,223,372,036,854,775,808 ~ 
  // +9,223,372,036,854,775,807
  public static long[] longs()
  {
    var _s = Console.ReadLine().Split();

    var x = new long[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = long.Parse(_s[i]);

    return x;
  }

  public static double[] doubles()
  {
    var _s = Console.ReadLine().Split();

    var x = new double[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = double.Parse(_s[i]);

    return x;
  }

  public static BigInteger[] bigs()
  {
    var _s = Console.ReadLine().Split();

    var x = new BigInteger[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = BigInteger.Parse(_s[i]);

    return x;
  }
}




Measured memory_bytes: 18912
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

__attribute__ ((constructor))
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
}


void solve(vector<int> &v){
  int size = v.size();
  vector<int> ans;
  rep(i,size){
    int pivod = -1;
    rrep(i,v.size()){
      if(v[i] == i){
        pivod = i;
        // cout << pivod + 1 << endl;
        break;
      }
    }
    if(pivod == -1){
      cout << -1 << endl;
      return ;
    }
    ans.push_back(pivod);
    v.erase(v.begin() + pivod);
  }
  reverse(ans.begin(), ans.end());
  // cout << "finish" << endl;
  for(auto u : ans){
    cout << u + 1 << endl;
  }
}


signed main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n){
    cin >> v[i];
    v[i]--;
  }
  solve(v);
  return 0;
}

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

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  int a,b; cin>>a>>b;
  if (a+b>=10) cout << "error" << endl;
  else cout << a+b << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
int ans=0;
for(int i=0;i<n;i++){
int a=Integer.parseInt(br.readLine());
if(isPrime(a)) ans++;
}
out.println(ans);
out.flush();
}

private static boolean isPrime(int a){
if(a==2||a==3||a==5||a==7) return true;
if(a%2==0) return false;
for(int i=3;i<=Math.sqrt(a);i++){
if(a%i==0) return false;
}
return true;
}
}

Measured memory_bytes: 22684
from collections import defaultdict as dd
n=int(input())
s=[]
for i in range(n):
    tmp=list(input())
    tmp.sort()
    tmp=''.join(tmp)
    s.append(tmp)

d=dd(int)
for ss in s:
    d[ss]+=1
ans=0
for k,v in d.items():
    if v>=2:
        ans+=v*(v-1)//2
print(ans)



Measured memory_bytes: 19728
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<map>
#include<queue>
#include<vector>
#include<stack>
#include<set>
#include<cctype>
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pb push_back

using namespace std;

inline ll read()
{
	long long f=1,sum=0;
	char c=getchar();
	while (!isdigit(c)) {if (c=='-') f=-1;c=getchar();}
	while (isdigit(c)) {sum=sum*10+c-'0';c=getchar();}
	return sum*f;
}
const int MAXN=1010;
int a[MAXN];
ll s[MAXN];
set <ll> se;
bool use[MAXN*MAXN];
int num[MAXN];
int dig[66],n;
int Count(ll now)
{
	int b=0;
	for (int i=1;i<=n;i++)
		for (int j=i;j<=n;j++)
		{
			ll q=s[j]-s[i-1];
			if ((now&q)==now) b++; 
		}
	return b;
}
int main()
{
	n=read();int k=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) s[i]=s[i-1]+a[i];
	ll ans=0;
	for (int i=60;i>=0;i--)
	{
		ans|=(1ll<<i);
		if (Count(ans)<k) ans-=(1ll<<i);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
//#define LOCAL
using namespace std;
typedef long long ll;
multiset<ll>s;

int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll q;
cin>>q;
for(ll i=0;i<q;i++){
    ll a,b;
    cin>>a>>b;
    if(0==a){
        s.insert(b);
        cout<<s.size()<<endl;
    }else if(1==a){
        cout<<s.count(b)<<endl;
    }else if(2==a){
        s.erase(b);
    }else{
        ll t;
        cin>>t;
        set<ll>::iterator i1=s.lower_bound(b);
        set<ll>::iterator i2=s.upper_bound(t);
        for(;i1!=i2;i1++) cout<<(*i1)<<endl;
    }
}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}



Measured memory_bytes: 12340
#include <cstdio>

#define cmax(a,b) ((a)>(b)?(a):(b))

template<class T>void fr(T &a) {
    T w=0,s=1;char c=getchar();
    while(c<'0'||c>'9') {if(c=='-')s=-1;c=getchar();}
    while(c>='0'&&c<='9') w=w*10+c-'0',c=getchar();
    a=w*s;
}
template<class T>T fr() {T a;fr(a);return a;}
#define R() fr<int>()

signed main() {
    int a=R(),b=R();
    return !printf("%d\n",cmax(0,a-b*2));
}

/*
03210120123452101
<>>><<><<<<<>>><

6+3+15+3+1=28
*/

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<deque>
using namespace std;

int main() {

    string line;
    while(getline(cin, line)) {
        if (line == "END OF INPUT") break;

        bool afterspace = true;
        int count = 0;
        for(int i = 0; i < line.length(); i++) {
            if ( line[i] != ' ' ) {
                afterspace = false;
                count += 1;
            } else {
                if(!afterspace) {
                    cout << count;
                    count = 0;
                } else {
                    cout << "0";
                    count = 0;
                }
            }
        }
        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a[3]; 
    int b[3]={5,5,7};
    bool flag=false;

    for(int i=0;i<3;i++){
       cin >> a[i];
    }
    sort(a,a+3);
     if(a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2]){
         flag=true;
     }

     (flag? cout << "YES" << endl: cout << "NO" << endl );
    
    return 0;
}

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

int main(){
  int n,x;
  cin>>n>>x;
  int ans;
  for(int i=0;i<n;i++){
	int k;
	cin>>k;
	k=abs(k-x);
	ans=(i?__gcd(ans,k):k);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String[] params = in.nextLine().split( " " );
        int n = Integer.parseInt( params[0] );
        int k = Integer.parseInt( params[1] );
        long s = Long.parseLong( params[2] );

        if( k == 0 ){
            for( int i = 0 ; i < n ; i++ ){
                if( i != 0 ){
                    System.out.print(" ");
                }
                if( s == 1000000000 ){
                    System.out.print( s - 1 );
                }
                else {
                    System.out.print( s + 1 );
                }
            }
            System.out.println();
            return;
        }

        for( int i = 0 ; i < k ; i++ ){
            if( i != 0 ){
                System.out.print(" ");
            }
            System.out.print( s );
        }
        for( int i = 0 ; i < n - k ; i++ ){
            if( s == 1000000000 ){
                System.out.print( " " + ( s - 1 ) );
            }
            else {
                System.out.print( " " + ( s + 1 ) );
            }
        }
        System.out.println();

    }

}

Measured memory_bytes: 42428
#include<iostream>
using namespace std;
int main(){
	int N,K,i,j,s=0,tmp;
	cin>>N>>K;
	int p[N];
	for(i=0;i<N;i++){
		cin>>p[i];
	}
	for(i=0;i<N;i++){
		for(j=i+1;j<N;j++){
			if(p[i]>p[j]){
				tmp=p[i];
				p[i]=p[j];
				p[j]=tmp;
			}
		}
	}
	for(i=0;i<K;i++){
		s=s+p[i];
	}
	cout<<s<<endl;
}

Measured memory_bytes: 3632
n, a, b = list(map(int, input().rstrip().split()))
if (b - a) % 2 == 0:
    print((b-a) // 2)
else:
    if a - 1 <= n - b:
        print(a + (b - a - 1) // 2)
    else:
        print(n - b + 1 + (b - a - 1) // 2)

Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}
char s[55][55];

int main(void){
    int n;
    int j;
    int ans[300] = {0};
    int check[300] = {0};
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%s", s[i]);
    }
    for (int i = 0; i < n; i++){
        j = 0;
        while (s[i][j] != '\0'){            
            if (i == 0){
                ans[s[i][j]]++;
            }else{
                check[s[i][j]]++;
            }
            j++;
        }
        if (i != 0){
            for (int k = 0; k < 300; k++){
                if (ans[k] > check[k]){
                    ans[k] = check[k];
                }
            }
        }
        for (int k = 0; k < 300; k++){
            check[k] = 0;
        }
    }
    for (int k = 0; k < 300; k++){
        if (ans[k] > 0){
            for (int i = 0; i < ans[k]; i++){
                printf("%c", (char)k);
            }
        }
    }
    printf("\n");


    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++) //最初の数値を指定したループ

//型名省略
typedef long long ll;

//配列要素数
static const int MAX = 200000;

using namespace std;

//#include "./lib/generic/sort.h"

std::tuple<int, int> swap(int num1, int num2){
     return std::forward_as_tuple(num1, num2);
}

void traceArray(int A[], int N){
    for(int i=0; i<N; i++){
        cout << A[i];
        if(i!=N-1){
            cout  << " ";
        }
    }
    cout << endl;
}

void sortByBubble(int A[], int N){
    int flag = 1;
    int count = 0;
    for(int i=0; flag; i++){
        flag = 0;
        for(int j=N-1; j>=i+1; j--){
            if(A[j]<A[j-1]){
                std::tie(A[j], A[j-1]) = swap(A[j-1], A[j]);
                flag = 1;
                count++;
            }
        }
    }
    traceArray(A, N);
    cout << count << endl;
}

int main(){
    int  N;
    cin >> N;
    int  A[N];
    REP(i, N) cin >> A[i];
    //sort::Sort test;
    //traceArray(A, N);
    //test.sortByIntention(A, N);
    //traceArray(A, N);
    sortByBubble(A, N);

    return 0;
}


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

using namespace std;
int main(){
	string s;
	cin >> s;
	int a = (s[0]-'0')*10 + (s[1]-'0');
	int b = (s[2]-'0')*10 + (s[3]-'0');
	if(a <= 12 && b<= 12 && a && b) puts("AMBIGUOUS");
	else if(a <= 12 && a) puts("MMYY");
	else if(b <= 12 && b) puts("YYMM");
	else puts("NA");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n; cin >> n;
    vector<ll> x(n), y(n), sum(n), sub(n);
    rep(i, n){
        cin >> x[i] >> y[i];
        sum[i] = x[i] + y[i];
        sub[i] = x[i] - y[i];
    }
    sort(sum.begin(), sum.end());
    sort(sub.begin(), sub.end());
    ll res = sum[n - 1] - sum[0];
    chmax(res, sub[n - 1] - sub[0]);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 9584
#include <stdio.h>

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


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF (ll)(1e17+5)
#define NN (ll)(1e6+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
vector <ll> adj[2005],visit(2005,0);
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       ll n,x,y,i,d[2005];
       cin>>n>>x>>y;
       map <ll,ll> mp;
       for(i=1;i<n;i++)
        {
            adj[i].pb(i+1);
            adj[i+1].pb(i);
            d[i]=INF;
        }
        d[n]=INF;
        adj[x].pb(y);
        adj[y].pb(x);
        queue <ll> q;
        for(i=1;i<=n;i++)
        {
            q.push(i);
            visit[i]++;
            d[i]=0;
            while(!q.empty())
            {
                ll v=q.front();
                q.pop();
                for(auto u:adj[v])
                {
                    if(!visit[u])
                    {
                        visit[u]++;
                        d[u]=min(d[v]+1,d[u]);
                        mp[d[u]]++;
                        q.push(u);
                    }
                }
            }  
            for(ll j=1;j<=n;j++)
            {
             visit[j]=0;
             d[j]=INF;
            } 
        } 
        /*for(i=1;i<=n;i++)
         cout<<d[i]<<" ";
        cout<<"\n";*/ 
        for(i=1;i<n;i++)
         cout<<mp[i]/2<<"\n";  
   }
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(){
	int n,m;
	string S;
	cin>>S;
	rep(i,S.size()-8){
		cout<<S[i];
	}
	cout<<endl;
	return 0;
}



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

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void)
{
 int n,i,j,x[200100],x2[200100],med1,med2;
 scanf("%d",&n);
 for(i=0;i<n;i++)
  scanf("%d",&x[i]);
 for(i=0;i<n;i++)
  x2[i] = x[i];

 qsort(x, n, sizeof(int), compare_int);

 med2 = x[n/2];
 med1 = x[(n/2)-1];

 for(i=0;i<n;i++){
  if(x2[i]<=med1)
   printf("%d \n",med2);
  else
   printf("%d \n",med1);
 } 

 return 0;
}

Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*/
#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
    vector <string> v;
    stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x);
    return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
    cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
    err(++it, args...);
}
 
int ini(){int x; scanf("%d",&x);return x;}
long long inl(){ long long x;scanf("%lld",&x); return x;}
double ind(){double x; scanf("%lf",&x);return x;}
#define Iin ini();
#define Lin inl();
#define Din ind();

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

int a[N];

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int t=1,te=0;
   // cin>>t;
    while(t--){
        int n;
        cin>>n;

        for(int i=1;i<=n;++i)cin>>a[i];

        int mi=INT_MAX,res=0;

        for(int i=1;i<=n;i++){
            mi=min(a[i],mi);
            if(a[i]<=mi or i==1){
                ++res;
            }
            
        }
        printf("%d\n", res);

        //printf("Case %d: ",++te);
    }
    return 0;
}




Measured memory_bytes: 1024
package main

import (
	"bufio"
	"errors"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

// NextLine reads a line text from stdin, and then returns its string.
func NextLine() string {
	sc.Scan()
	return sc.Text()
}

// NextIntsLine reads a line text, that consists of **ONLY INTEGERS DELIMITED BY SPACES**, from stdin.
// And then returns intergers slice.
func NextIntsLine() []int {
	ints := []int{}
	intsStr := NextLine()
	tmp := strings.Split(intsStr, " ")
	for _, s := range tmp {
		integer, _ := strconv.Atoi(s)
		ints = append(ints, integer)
	}
	return ints
}

// NextRunesLine reads a line text, that consists of **ONLY CHARACTERS ARRANGED CONTINUOUSLY**, from stdin.
// Ant then returns runes slice.
func NextRunesLine() []rune {
	return []rune(NextLine())
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// PowInt is integer version of math.Pow
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}
	fa := float64(a)
	fe := float64(e)
	fanswer := math.Pow(fa, fe)
	return int(fanswer)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	fa := float64(a)
	fanswer := math.Abs(fa)
	return int(fanswer)
}

// DeleteElement returns a *NEW* slice, that have the same and minimum length and capacity.
// DeleteElement makes a new slice by using easy slice literal.
func DeleteElement(s []int, i int) []int {
	if i < 0 || len(s) <= i {
		panic(errors.New("[index error]"))
	}
	// appendのみの実装
	n := make([]int, 0, len(s)-1)
	n = append(n, s[:i]...)
	n = append(n, s[i+1:]...)
	return n
}

// Concat returns a *NEW* slice, that have the same and minimum length and capacity.
func Concat(s, t []rune) []rune {
	n := make([]rune, 0, len(s)+len(t))
	n = append(n, s...)
	n = append(n, t...)
	return n
}

// sort package (snippets)
//sort.Sort(sort.IntSlice(s))
//sort.Sort(sort.Reverse(sort.IntSlice(s)))
//sort.Sort(sort.Float64Slice(s))
//sort.Sort(sort.StringSlice(s))

// copy function
//a = []int{0, 1, 2}
//b = make([]int, len(a))
//copy(b, a)

/*******************************************************************/

var n int
var indices []int

func main() {
	tmp := NextIntsLine()
	n = tmp[0]
	indices = make([]int, 1000)
	for i := 1; i <= n; i++ {
		a := i
		// aを素因数分解
		max := math.Pow(float64(i), 0.5)
		for j := 2; j <= int(max); j++ {
			for {
				if a%j == 0 {
					indices[j]++
					a /= j
				} else {
					break
				}
			}
		}
		if a != 1 {
			indices[a]++
		}
	}

	answer := 1
	for _, idx := range indices {
		answer = (answer * (idx + 1)) % 1000000007
	}
	fmt.Println(answer)
}


Measured memory_bytes: 640
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord

main :: IO ()
main = getLine >> readLine >>= print . solve . sortBy cmpf
    where
        cmpf = comparing abs

solve :: [Int] -> Int
solve as
    | odd nc = sum bs - b 
    | otherwise = sum bbs
    where
        bbs@(b : bs) = map abs as
        nc = foldl' ff 0 as
        ff acc x
            | x < 0 = acc + 1
            | otherwise = acc 

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

Measured memory_bytes: 17660
A = int(input())
B = int(input())
C = int(input())
D = int(input())
minvalue1 = 10000
minvalue2 = 10000
m = [A, B]
n = [C, D]
for i in range(len(m)):
    if m[i] < minvalue1:
        minvalue1 = m[i]
for z in range(len(n)):
    if n[z] < minvalue2:
        minvalue2 = n[z]
print(minvalue1+minvalue2)

Measured memory_bytes: 38256
#include <iostream>
using namespace std;
int main(){
  int h,w;cin>>h>>w;
  int mp[h][w];
  for(int i = 0; h > i; i++){
    int sm = 0;
    for(int j = 0; w > j; j++){
      cin>>mp[i][j];sm+=mp[i][j];
      cout << mp[i][j] << " ";
    }
    cout << sm << endl;
  }
  int ret = 0;
  for(int i = 0; w > i; i++){
    int sm = 0;
    for(int j = 0; h > j; j++){
      sm += mp[j][i];
    }
    ret += sm;
    cout << sm << " ";
  }
  cout << ret << endl;
}


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

int main() {
string S;cin >> S;
string T = S;
int Ans = 0;
int A = 0, B = 0;

for(int i = 0; i < S.length(); i++){

if(i%2 == 0 && S.at(i) == '1'){
S.at(i) = '0';A++;}

if(i%2 == 1 && S.at(i) == '0'){
S.at(i) = '1';A++;}

}

S = T;

for(int i = 0; i < S.length(); i++){

if(i%2 == 0 && S.at(i) == '0'){
S.at(i) = '1';B++;}

if(i%2 == 1 && S.at(i) == '1'){
S.at(i) = '0';B++;}

}
Ans = min(A, B);cout << Ans << endl;
}

Measured memory_bytes: 512
N,W = map(int,input().split())
dic = {"0":[],"1":[],"2":[],"3":[]}
for i in range(N):
  w,v = map(int,input().split())
  if i == 0:
    Min = w
  if w == Min:
    dic["0"].append(v)
  elif w == Min+1:
    dic["1"].append(v)
  elif w == Min+2:
    dic["2"].append(v)
  elif w == Min+3:
    dic["3"].append(v)
    
dic["0"].sort(reverse=True)
dic["1"].sort(reverse=True)
dic["2"].sort(reverse=True)
dic["3"].sort(reverse=True)

ans = 0
for i in range(len(dic["0"])+1):
  for j in range(len(dic["1"])+1):
    for k in range(len(dic["2"])+1):
      for l in range(len(dic["3"])+1): 
        a = int(sum(dic["0"][:i])+sum(dic["1"][:j])+sum(dic["2"][:k])+sum(dic["3"][:l])) 
        b = int(i*Min+j*(Min+1)+k*(Min+2)+l*(Min+3))
        if a > ans and b <= W:
          ans = a
print(int(ans))

Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
	int deb = 100000;
	int rest;
	int n;
	int i;

	scanf("%d", &n);

	for(i = 0 ; i < n ; i++){
		deb *= 1.05;
		rest = deb % 1000;
		if(rest != 0){
			deb -= rest;
			deb += 1000;
		}
	}

	printf("%d\n", deb);

	return 0;
}

Measured memory_bytes: 592
#include<stdio.h>
#include<string.h>
 
int main(){
  int c[4][14]={};
  char m1[3];
  int num,m2;
  int i,j,n;
   
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%s%d",m1,&num);
     
    if(strcmp(m1,"S")==0)
      m2=0;
    else if(strcmp(m1,"H")==0)
      m2=1;
    else if(strcmp(m1,"C")==0)
      m2=2;
    else if(strcmp(m1,"D")==0)
      m2=3;
     
    c[m2][num]=1;
  }
   
  for(i=0;i<4;i++){
    for(j=1;j<14;j++){
      if(!c[i][j]){
    if(i==0)
      printf("S %d\n",j);
    else if(i==1)
      printf("H %d\n",j);
    else if(i==2)
      printf("C %d\n",j);
    else if(i==3)
      printf("D %d\n",j);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include<cstdio>
#include<iostream>
using namespace std;
const int MAXN=8;
const int INF=100000;
int n;
int six[MAXN],nin[MAXN];
int dp[INF+1];
int main(){
	scanf("%d",&n);
	six[0]=nin[0]=1;
	for(int i=1;i<MAXN;++i){
		six[i]=six[i-1]*6;
		nin[i]=nin[i-1]*9;
	}
	for(int i=1;i<=n;++i){
		dp[i]=i;
		for(int j=0;j<MAXN;++j){
			if(six[j]>i) break;
			dp[i]=min(dp[i],dp[i-six[j]]+1);
		}
		for(int j=1;j<MAXN;++j){
			if(nin[j]>i) break;
			dp[i]=min(dp[i],dp[i-nin[j]]+1);
		}
	}
	printf("%d",dp[n]);
	return 0;
}

Measured memory_bytes: 640
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = [0] + A

i = 1
n = 1
past = [0] * (N+i)
while K:
    if past[i] != 0:
        #print("twice",i , n, past[i])
        sub = n - past[i]
        K = K % sub
        break

    past[i] = n
    #print(i, n, past[i])
    i = A[i]
    n += 1
    K -= 1
    
while K:
    i = A[i]
    K -= 1
    
print(i)

Measured memory_bytes: 32412
n,m = gets.chomp.split(" ").map(&:to_i)
if m > 2 && n > 2
  puts (n-2)*(m-2)
elsif n == 2 || m == 2
  puts 0
elsif !(n == 1 && m == 1)
  puts ([n,m].max) - 2
else
  puts 1
end

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
string str[110];
int main()
{
    int N,L,i,flag=0;
    scanf("%d%d",&N,&L);
    getchar();
    for(i=0;i<N;i++)
        cin >> str[i];
   sort(str,str+N);
   for(i=0;i<N;i++)
    //printf("%s",str[i]);
    cout << str[i];
    return 0;
}

Measured memory_bytes: 256