akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
#define INF (1L * 1e18)
typedef long long ll;

using namespace std;
typedef pair<int, int> pii;

struct edge {
    // 辺.
    int to;
    int cost;
};

// library
void dijkstra(vector<vector<edge>>& g, vector<ll>& d, int s){
    priority_queue<pii, vector<pii>, greater<pii>> q;
    d[s] = 0;
    // 経路もしりたい場合は前の点も記録
    vector<ll> pre(d.size(), -1);
    pii pi(0, s);
    q.push(pi);

    while(! q.empty()){
        pii p = q.top();
        q.pop();
        for(edge e : g[p.second]){
            int to = e.to;
            ll tmp = d[p.second] + e.cost;
            if(tmp < d[e.to]){
                d[e.to] = tmp;
                pre[e.to] = p.second;
                q.push(pii {tmp, e.to});
            }
        }
    }
}

int main(){
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s --;
    t --;
    vector<vector<edge>> gY(n);
    vector<vector<edge>> gS(n);

    rep(i, m){
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u --; v --;
        edge eY{v, a};
        edge eS{v, b};
        gY[u].push_back(eY);
        gY[v].push_back(edge{u, a});
        gS[u].push_back(eS);
        gS[v].push_back(edge{u, b});
    }
    vector<ll> dY(n, INF);
    dY[s] = 0;
    vector<ll> dS(n, INF);
    dS[t] = 0;

    dijkstra(gY, dY, s);
    dijkstra(gS, dS, t);

    vector<ll> ans(n, -1);

    ll prev = dY[n - 1] + dS[n - 1];

    rep(i, n){
        int mp = n - 1 - i;
        ll tmp = dY[mp] + dS[mp];

        if(tmp < prev){
            ans[mp] = tmp;
        }else{
            ans[mp] = prev;
        }
        prev = ans[mp];
    }

    rep(i, n){
        ll tmp = 1e15 * 1L - ans[i];
        cout << tmp << endl;
    }

    return 0;
}




Measured memory_bytes: 16072
#include <bits/stdc++.h>
#define N 25
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)	for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define form(l, r, i)	for(int i = l; i <= r; ++i)
#define forv(r, l, i)	for(int i = r; i >= l; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
#define getb __builtin_popcount

const int inf = 1e9 + 7;
const lld EPS = 0.00000001;
const ll modw = 1e9 + 7;
 
using namespace std;

ll dp[(1 << N)]; // subset of womens(mask)
bool can[N][N];

int main()
{
	barnarnar
	int n;
	cin >> n;
	forn(i, n)	forn(j, n)	cin >> can[i][j];
	dp[0] = 1;
	for(int mask = 0; mask < (1 << n) - 1; mask++)
	{
		int a = getb(mask); // number of 1 bits in mask(current man to connect)
		for(int b = 0; b < n; b++)
		{
			if(can[a][b] && !(mask & (1 << b))) // if can and women b not in mask already
			{
				int mask_to = mask ^ (1 << b); // set b bit to 1(b women added)
				dp[mask_to] += dp[mask];
				dp[mask_to] %= modw;
			}
		}
	}
	cout << dp[(1 << n) - 1];
	return 0;
}

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


int main() {
	string s;
	cin >> s;

	int counter = 0;

	for (int i = 0; i < s.size() / 2; i++) {
		if (s[i] != s[(s.size()-1) - i])	counter++;
	}

	cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=3e5,mod=1e9+7;
ll cum[N][61],x[N];
int main()
{
    int n;
    cin>>n;
    for (int i=1; i<=n; ++i)
        cin>>x[i];
    for (int i=n; i>=1; --i)
    {
        for (ll j=0; j<=60; ++j)
        {
            if (x[i]&(1LL<<j))
                cum[i][j]++;
            cum[i][j]+=cum[i+1][j];
        }
    }
    ll sum=0;
    for (int i=1; i<=n; ++i)
    {
        for (ll j=0; j<=60; ++j)
        {
            ll q=cum[i+1][j];
            ll t=(1LL<<j);
            if (x[i]&t)
                sum=(((((n-i-q)%mod)*(t%mod))%mod)+(sum%mod))%mod;
            else
                sum=((((q%mod)*(t%mod))%mod)+(sum%mod))%mod;
        }
    }
    cout<<sum<<"\n";
    return 0;
}


Measured memory_bytes: 145536
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;

int main(){
    int k,a,b;cin>>k>>a>>b;
    if(b-a+1>=k||a%k==0||b%k<a%k)cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


auto solve() {
    int n;
    cin >> n;
    vi A(n), B(n);
    REP(i, n) {
        cin >> A[i] >> B[i];
    }

    ll Tk = 0, Ao = 0;

    vector<pii> C(n);
    REP(i, n) {
        C[i] = make_pair(A[i] + B[i], i);
    }
    sort(all(C));
    reverse(all(C));

    REP(i, n) {
        if (i % 2 == 0)
            Tk += A[C[i].second];
        else
            Ao += B[C[i].second];
    }

    return Tk - Ao;
}


int main() {
    cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);

//    cout << (solve() ? "Yes" : "No") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

int b[200][55];
char a[100];
int main(){
    memset(b,0,sizeof(b));
    int n;
    scanf("%d",&n);
    for(int j = 0; j < n; j++){
        scanf("%s",a);
        for(int i = 0; i < strlen(a); i++)
            b[a[i]][j]++;
    }
    for(int i = 0; i < 200; i++){
        sort(b[i],b[i]+n);
        while(b[i][0]--){
            printf("%c",i);
        }
    }
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
a = [None] + list(map(int, input().split()))

b = [0] * (n + 1)
for i in range(n, 0, -1):
  dprint('i', '=', i)
  t = 0
  if n // 2 < i:
    b[i] = a[i]
  else:
    for j in range(i, n + 1, i):
      dprint('j', '=', j)
      t += b[j]
    b[i] = (a[i]+t) % 2

dprint(b)

print(b.count(1))
for i, x in enumerate(b):
  if x == 1:
    print(i, end=' ')


Measured memory_bytes: 8628
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

using namespace std;

typedef long long ll;

typedef pair<int,int> P1;
typedef pair<int,P1> P2;
const ll inf=100000000000000;
struct edge{
	int to,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

#define MAX_N 100002
int dp[60][MAX_N]={};
int rdp[60][MAX_N]={};
int d[MAX_N]={};
//bool d[MAX_N]={};
int pa[MAX_N];

vector<int> G[MAX_N];

vector<int> child[MAX_N];
vector<int> ra[MAX_N];
priority_queue<P2,vector<P2>,greater<P2>> que2;
queue<pos> que;
vector<int> vec;
bool R[501][501]={};
bool B[501][501]={};
int main() {

	int h,w;
	cin>>h>>w;
	rep(i,h){
		rep(j,w){
			char chr;
			cin>>chr;
			if(chr=='#'){
				R[i][j]=true;
				B[i][j]=true;
			}
			if(i%2==0){
				R[i][j]=true;
			}else{
				B[i][j]=true;
			}
		}
		R[i][0]=true;
		B[i][w-1]=true;
		R[i][w-1]=false;
		B[i][0]=false;
	}

	rep(i,h){
		rep(j,w){
			if(R[i][j]){
				cout<<"#";
			}else{
				cout<<".";
			}
		}
		cout<<endl;
	}
	cout<<endl;
	rep(i,h){
		rep(j,w){
			if(B[i][j]){
				cout<<"#";
			}else{
				cout<<".";
			}
		}
		cout<<endl;
	}
		return 0;

}


Measured memory_bytes: 8960
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt(),l=scan.nextInt();
		ArrayList<String> dict = new ArrayList<String>();
		for(int i=0; i<n; i++) {
			dict.add(scan.next());
		}
		Collections.sort(dict);
		String result="";
		for(int i=0; i<n; i++) {
			result+=dict.get(i);
		}
		System.out.println(result);
 	}

}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
const double eps=1e-8;
const double PI=acos(-1);
const double PI2=PI*2.0;
typedef pair<double,double> Data;

double solve(vector< Data > d){
  sort(d.begin(),d.end());
  int n=d.size();
  double res=0;
  for(int i=0;i<n;i++){
    if(i+1<n && d[i].second >= d[i+1].first ){
      d[i+1].first=min(d[i+1].first,d[i].first);
      d[i+1].second=max(d[i+1].second,d[i].second);
    }else{
      res+=(d[i].second-d[i].first);
    }
  }
  return res;
}

int main(){
  int n;
  cin>>n;
  vector<P> t;
  for(int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    t.push_back( P(x,y) );
  }

  for(int i=0;i<n;i++){
    vector<Data> d;
    for(int j=0;j<n;j++){
      if(i==j)continue;
      P v=t[j]-t[i];
      double fi=arg(v * P(0,-1) );
      if(fi<0)fi+=PI2;
      double se=arg(v * P(0,1) );
      if(se<0)se+=PI2;
      if( fi < se ){
        d.push_back( Data(fi,se) );
      }
      if( fi > se ){
        d.push_back( Data(fi,PI2) );
        d.push_back( Data(0,se) );
      }
    }
    double ans=  (PI2 - solve(d)) / PI2;
    printf("%.10f\n",ans);
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <map>

using namespace std;

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

    map <int, bool> flag;
    int d;

    while (k--){
        cin>>d;
        flag[d] = true;
    }

    for (int i=n;i<=99999;i++){
        int d = i;

        int p = 0;
        while ( d ){
            int mo = d % 10;
            if ( flag[mo] ) {
                p = 1;
                break;
            }
            d/=10;
        }

        if ( p == 0 ) {
                cout<<i<<endl;
                return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, std::vector<long long> A){
  for(ll i=0; i<N; i++) {
    if((A[i]>i) or (i+1<N and A[i+1]-A[i]>1)) {
      std::cout << -1 << std::endl;
      return;
    }
  }
  vector<ll> v(N, 0);
  for(ll i=0; i<N; i++) {
    v[i-A[i]] = A[i];
  }
  ll ans = 0;
  for(auto x:v)
    ans+=x;
  std::cout << ans << std::endl;
  
  
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}



Measured memory_bytes: 3328
#include <iostream>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    for (ll i = 0; ; i++){
        ll a = (n + i) % 10, b = (n + i) / 100, c = (n + i) / 10 % 10;
        if (a == b && a == c){
            cout << (n + i) << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Created by Santa on 2016/10/16.
 */
public class Main {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        int[][] map = new int[N][26];

        scanner.nextLine();

        for (int i = 0; i < N; i++) {
            String s = scanner.nextLine();

            for (int j = 0; j < s.length(); j++) {
                map[i][(s.charAt(j) - 'a')]++;
            }
        }


        int[] ans = new int[26];

        for (int i = 0; i < 26; i++) {
            int min = 9999;
            for (int j = 0; j < N; j++) {
                min = Math.min(map[j][i], min);
            }
            ans[i] = min;
        }


        for (int i = 0; i < 26; i++) {
            for (int j = 0; j < ans[i]; j++) {
                System.out.print((char) ('a' + i));
            }
        }

        System.out.println();

    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  typedef pair<int,int> P;
  std::vector<P> ans;
  int x,y;cin>>x>>y;
  while(x||y){
    ans.push_back(P(min(x,y),max(x,y)));
    cin>>x>>y;
  }
  for(auto p:ans)cout<<p.first<<" "<<p.second<<endl;
}



Measured memory_bytes: 3156
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;

 int main()
 {
   int n;
   cin>>n;
   while(n--)
   {
     string s;
     int alpha[26]={0};
     deque<char> mm;
     deque<char>::iterator iter;
     cin>>s;
     mm.push_back(s[0]);
     alpha[s[0]-'a']++;
     for(int i=0;(i+3)<s.length();i=i+3)
     {
       if(s[i+1]=='-'&&s[i+2]=='>')
       {
         if(!alpha[s[i+3]-'a']) mm.push_back(s[i+3]);
         alpha[s[i+3]-'a']++;                                
       }
       else
       {
         if(!alpha[s[i+3]-'a']) mm.push_front(s[i+3]);
         alpha[s[i+3]-'a']++;     
       }        
     }          
     for(iter=mm.begin();iter!=mm.end();++iter)
     {
       cout<<(*iter);                                        
     }
     cout<<endl;
   } 
   //while(1);
   return 0;
 }

 

Measured memory_bytes: 3184
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5, 0);
  int k;
  REP(i, 5) cin >> a[i];
  cin >> k;
  REP(i, 5) {
    for (int j = i; j < 5; j++) {
      if (abs(a[i] - a[j]) > k) {
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  cout << "Yay!" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int d = sc.nextInt();
			int area = 0;
			for(int x=0;x<600;x+=d) {
				area += x * x * d;
			}
			System.out.println(area);
		}
	}

}

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

bool KBjudge(string x) {
	
  string x_ = x;
  reverse(x.begin(), x.end());
  return (x_ == x);
}


int main(){
  
  double L;
  cin >> L;
  
  double a = L/3;
  a = pow(a, 3);
  printf("%.6f", a);
  //cout << a << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n;
    cin >> n;
    long long int a[n];
    long long int sum=0;
    for(long long int i=0;i<n;i++){
        cin >> a[i];
        a[i] -= (i+1);
        sum += a[i];
    }
    sort(a,a+n);
    long long int tmp=0;
    long long int ans=1e18;
    for(long long int i=0;i<n;i++){
        tmp += a[i];
        ans=min(ans,sum+(2*(i+1)-n)*a[i]-2*tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

int main(void) {
    Int n, k;
    cin >> n >> k;
    if (k == 1) {
        cout << 0 << endl;
    } else {
        cout << n - k << endl;
    }
    return 0;
}


Measured memory_bytes: 3584
while n=gets.to_i
  break if n==0
  s=gets.split.map(&:to_f)
  m=0
  s.each{|i| m+=i}
  m=m/n
  sig2=0.0
  s.each{|i| sig2=sig2+(m-i)**2 }
  puts Math.sqrt(sig2/n)
end

Measured memory_bytes: 6160
#include <stdio.h>
#include <vector> 
#include <algorithm>
#include <functional>
#include <iostream>


using namespace std;

int main(){
	int n,i,j;
	
	vector<int>::iterator pos;
	
	while(0<=scanf("%d",&n)){
		if(n==0)break;
		
		vector<int> taro,hanako;
		
		for(i=0;i<n;i++){
			scanf("%d",&j);
			taro.push_back(j);
		}
		
		sort(taro.begin(),taro.end());
		
		
		for(i=1;i<=2*n;i++){
			if(taro.end()==find(taro.begin(),taro.end(),i)){
				hanako.push_back(i);
			}
		}
		
		sort(hanako.begin(),hanako.end());
		
		int ba=0,ban=0;
		while(!hanako.empty() && !taro.empty()){
			
			if(ba==2*n){
				ban=(ban+1)%2;
				ba=0;
			}
			
			if(0==ban){
				ban=1;
				for(i=ba+1;i<=2*n;i++){
					pos=find(taro.begin(),taro.end(),i);
					if(taro.end()!=pos){
						ba=i;
						pos=remove(taro.begin(),taro.end(),i);
						taro.erase(pos,taro.end());
						break;
					}else if(i>=2*n){
						ba=0;
					}
				}
			}else{
				ban=0;
				for(i=ba+1;i<=2*n;i++){
					pos=find(hanako.begin(),hanako.end(),i);
					if(hanako.end()!=pos){
						ba=i;
						pos=remove(hanako.begin(),hanako.end(),i);
						hanako.erase(pos,hanako.end());
						break;
					}else if(i>=2*n){
						ba=0;
					}
				}
			}
		}
		cout<<hanako.size()<<endl;
		cout<<taro.size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。
    long[] nums = new long[n];
		for(long i = 0; i < n; i++)
    {
      nums[i] = long.Parse(Console.ReadLine());
    }
    long[][] dp = new long[n+1][];
		for(long i = 0; i <= n; i++)
    {
      dp[i] = new long[10001];
    }
    dp[0][0] = 1;

    for(long num = 0; num <= n; num++)
    {
      for(long sum = 0; sum <= 10000; sum++)
      {
        if(num>=1)
        {
          if(sum-nums[num-1] >= 0)
          {
            if(dp[num-1][sum-nums[num-1]] == 1) dp[num][sum] = 1;
          }
        }
        if(num>=1)
        {
          if(dp[num-1][sum] == 1) dp[num][sum] = 1;
        }
      }
    }

    long answer = 0;
    for(long i = 0; i < 10000; i++)
    {
      if(dp[n][i] == 1 && i % 10 != 0) answer = i;
    }
		
		Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。
	}
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
 
 
signed main()
{
  
  int r;cin>>r;
  cout<<r*r<<endl;
}

Measured memory_bytes: 256
n=gets.to_i
x,y=$<.map{|e|e.split.map &:to_i}.transpose
q=(x[0].abs+y[0].abs)%2
(1...n).each{|i|
    if (x[i].abs+y[i].abs)%2!=q
        p -1
        exit
    end
}
m=31+(q^1)
p m
puts m.times.map{|i|i==31?1:2**i}*' '
x=x.map{|e|e-1} if p==0
n.times{|i|
    u=x[i]+y[i]
    v=x[i]-y[i]
    puts 31.times.map{|j|'LDUR'[((u - 1) / 2 + (1 << 30))[j]*2+((v - 1) / 2 + (1 << 30))[j]]}.join+(q==0 ? 'R' : '')
}

Measured memory_bytes: 2172
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000001
using namespace std;
typedef long long ll;

int ans = 0;
bool rangeCheck(int n, int N){
  return (0 <= n && n <= N);
}
void sfth(ll n, ll N, bool in3, bool in5, bool in7){
  ll cn = n;
  if(rangeCheck(n, N)) if(in3 and in5 and in7) ans++;
  if(cn>N)  return;
  sfth(cn*10+3, N, true, in5, in7);
  sfth(cn*10+5, N, in3, true, in7);
  sfth(cn*10+7, N, in3, in5, true);
  return;
}

int main(){
  ll N;
  cin >> N;
  ll n=0;
  sfth(n+3, N, true, false, false);
  sfth(n+5, N, false, true, false);
  sfth(n+7, N, false, false, true);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
def op(a,b):
    return(a[0]*b[1]- a[1]*b[0])

def vec(a,b):
    return(b[0]-a[0],b[1]- a[1])

while True:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd = list(map(float,input().strip().split(',')))
        a = (xa,ya)
        b = (xb,yb)
        c = (xc,yc)
        d = (xd,yd)
        p1 = op(vec(a,b), vec(b,c))
        p2 = op(vec(b,c), vec(c,d))
        p3 = op(vec(c,d), vec(d,a))
        p4 = op(vec(d,a), vec(a,b))
        if (p1 > 0 and p2 > 0 and p3 > 0 and p4 > 0) or (p1 < 0 and p2 < 0 and p3 < 0 and p4 < 0):
            print("YES") 
        else:
            print("NO") 

    except EOFError:
        break

Measured memory_bytes: 7436
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	const int mod=1000000007;
	const long o=1;
	static Bit bit;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia,a=sc.Ia;
		long ans=0;
		int[][] h=new int[s[0]][];
		for(int i = 0;i<s[0];i++) {h[i]=new int[]{a[i],i+1};}
		Array.Sort(h,(u,v)=>u[0]-v[0]);
		bit=new Bit(s[0]);
		var hs=new Dictionary<string,int>();
		bit.Ud(h[0][1],1);
		ans=h[s[2]-1][0]-h[0][0];
		for(int i = 1;i<=s[0]-s[2];i++) {
			if(h[i+s[2]-1][0]-h[i][0]<ans){
				int p=0;
				for(int j = i;;j++) {
					long q=bit.Get(h[j][1]);
					int l=Fu(0,h[j][1],q)+(q==0?0:1),r=Fu(h[j][1],s[0]+1,q+1)-1;
					string t=l+" "+r;
					
					if(r-l-(hs.ContainsKey(t)?hs[t]:0)+1>=s[1]){
						if(j-i-p+1==s[2]){
							ans=h[i+s[2]-1+p][0]-h[i][0];
							break;
						}
					}
					else{
						p++;
						if(i+s[2]-1+p>=s[0]){break;}
						else if(h[i+s[2]-1+p][0]-h[i][0]>=ans){break;}
					}
					if(hs.ContainsKey(t)){hs[t]++;}
					else{hs.Add(t,1);}
				}
				hs.Clear();
			}
			bit.Ud(h[i][1],1);
		}
		Console.WriteLine("{0}",ans);
	}
	static int Fu(int lb,int ub,long q){
		int mid=0;
		while(ub-lb>1){
			mid=(ub+lb)/2;
			if(bit.Get(mid)>=q){ub=mid;}
			else{lb=mid;}
		}
		return ub;
	}
}
public class Bit{
	private int n;
	private long[] bit;
	public Bit(int n){
		this.n=n;
		bit=new long[n+1];
	}
	public void Ud(int a,long p){while(a<=n){bit[a]+=p;a+=a&-a;}}
	public long Get(int n){
		long a=0;
		while(n>0){a+=bit[n];n-=n&-n;}
		return a;
	}
	public long Get2(int m,int n){
		long a=0,b=0;
		while(n>m){a+=bit[n];n-=n&-n;}
		if(n==m){return a;}
		while(n!=m){b+=bit[m];m-=m&-m;}
		return a-b;
	}
	public void Clear(){bit=new long[n+1];}
}

class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 19964
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <map>
#include <set>
#include <cstring>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
 
 vector<long long>pb;
 vector<int>name;
 vector<char>life;
 vector<unsigned long>who;
 set<char>kshe;
 map<string,int>am; 

int main(){
	string s;
	cin>>s;
	int nax=0,c=1;
	for(int i=1;i<s.length();i++){
		if(s[i-1]==s[i]) c++;
		if(c>nax) nax=c;
		else c=0;
	}
	if(nax>=3) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
//  cerr<<"time elapsed: "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define rn return
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    int N, K; cin >> N >> K;
    vector<int> x(N);
    rep(i,N) cin >> x[i];
    
    int i = 0;
    int ans = 1e9;
    while (i + K <= N){
        
        int d = abs(x[i]-x[i+K-1])+min(abs(x[i]),abs(x[i+K-1]));
        ans = min(d,ans);
        i++;
    }
    
    cout << ans;
    rn 0;
}

Measured memory_bytes: 640
import java.util.*; 
import java.io.*;

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        long N = nextLong();
    
        int[] level = new int[100];

        int x = 0;
        while(N > 0){
            int temp = (int) (N % 26);
            if(temp==0){
                level[x] = 26;
                N = N/26-1;
            }
            else{
                level[x] = temp;
                N = N/26;
            }

            x++;
        }
       
        String ans = "";
        char alphabet[] = "abcdefghijklmnopqrstuvwxyz".toCharArray();
        for(int i = x-1; i>=0; i--){
            ans += alphabet[level[i]-1]; //0 base
        }

        System.out.println(ans);

        
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

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

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 37140
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#include <map>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <queue>


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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

using namespace std;

bool is_integer( float x ){
    return floor(x)==x;
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

//yakusuu rekkyo
vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // push its partner
            if (N/i != i) res.push_back(N/i);
        }
    }

    sort(res.begin(), res.end());
    return res;
}


vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // exponential

        // divide as much as you can
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // push the result
        res.push_back({a, ex});
    }

    // last num (if the lasting n is prime number and not 1)
    if (N != 1) res.push_back({N, 1});
    return res;
}



int main() {
    int n; cin >> n;
    int tmp;
    int ans = 0;

    rep(i,n){
        cin >> tmp;
        ans += tmp-1;
    }

    cout << ans;
    return 0;
}











Measured memory_bytes: 3580
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);



int main(){
    FIN;
    ll n; cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++) cin >> a[i];

    ll Max = 0;
    ll ans = 0;

    for(ll i=0;i<n;i++){
        if(a[i] < Max) ans += Max - a[i];
        Max = max(Max,a[i]);
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 4776
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
#define ll __int64
#define mmax 1010
using namespace std;
int h[11];
int main()
{
    for(int i=0;i<10;i++)
        scanf("%d",&h[i]);
    sort(h,h+10);
    for(int i=9;i>=7;i--)
    {
        cout<<h[i]<<endl;
    }
}

Measured memory_bytes: 1224
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,S[100000],q,T[50000],c=0,i,i2,toread,cnt;
	cin>>n;
	for(i=0;i<n;i++)cin>>S[i];
	cin>>q;
	for(i=0;i<q;i++)cin>>T[i];
	/*for(i=0;i<n;i++){
		for(i2=0;i2<n;i2++){
			if(S[i]<S[i2]){
				toread=S[i];
				S[i]=S[i2];
				S[i2]=toread;
			}
		}
	}*/
	sort(S,S+n);
	for(i=0;i<q;i++){
		cnt=0;
		toread=n;
		while(toread>1){
			if(toread%2==0)toread/=2;
			else toread=(toread+1)/2;
			if(S[(toread-1)+cnt]<T[i])cnt+=toread;
			else if(S[(toread-1)+cnt]==T[i]){
				c++;
				break;
			}
		}
	}
	cout<<c<<endl;
}

Measured memory_bytes: 3568
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long a;
        a = sc.nextLong();
        long b;
        b = sc.nextLong();

        final Solver solver = new Solver();
        solver.solve(a, b);
    }
}

class Solver {
    public void solve(long a, long b) {
        long ans = (b - a - 1) * (b - a) / 2 - a;
        System.out.println(ans);
    }
}



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

int main()
{
    double l;
    cin >> l;
    cout << setprecision(10) << pow(l / 3.0, 3.0) << endl;
    return 0;
}

Measured memory_bytes: 4160
// Aizu Vol0 0047: Cup Gamel
// 2017.7.29

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);

int main()
{
	char buf[100], *p;
	char x, y, pos;

	pos = 'A';
	while (gets(buf) != NULL) {
		p = buf;

		while (isspace(*p)) p++;
		x = *p++;

		while (isspace(*p)) p++;  // ','
		p++;

		while (isspace(*p)) p++;
		y = *p;

		if (x == pos) pos = y;
		else if (y == pos) pos = x;
	}
	putchar(pos), putchar('\n');
	return 0;
}

Measured memory_bytes: 524
use std::io;
use std::cmp::Ordering;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i32,
        b: i32,
        c: i32,
    }

    match a.cmp(&b){
        Ordering::Less => match b.cmp(&c){
            Ordering::Less => println!("Yes"),
            _ => println!("No"),
        },
        _ => println!("No"),
    }
}



Measured memory_bytes: 5028
import std;
import core.bitop;

// dfmt off
ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
void aryWrite(T = long)(T[] ary){ ary.map!(x => x.text()).join(' ').writeln(); }
alias Pair = Tuple!(long, "H", long, "W", long, "cost");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto n = lread();
    long k;
    while (k * (k - 1) / 2 < n)
        k++;

    if (n != (k * (k - 1) / 2))
    {
        writeln("No");
        return;
    }
    else
    {
        writeln("Yes");
        writeln(k);
    }

    auto a = new long[][](k, 0);
    long cur = 1, idx;
    while (cur <= n)
    {
        auto next = cur + (k - 1) - a[idx].length;
        auto j = iota(cur, next).array();
        // j.writeln();
        a[idx] ~= j;
        foreach (i; iota(idx + 1, k))
        {
            a[i] ~= j[i - (idx + 1)];
        }
        cur = next;
        idx++;
        // cur.writeln();
    }
    foreach (e; a)
    {
        writef("%s ", e.length);
        e.aryWrite();
    }
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 13040
import copy
from typing import List, Tuple


def _fill_forbidden_pos(board: List[List[int]], pos: Tuple[int, int]) -> None:
    row, col = pos[0], pos[1]
    # Horizontal.
    for i in range(8):
        board[row][i] = 1
    # Vertical.
    for i in range(8):
        board[i][col] = 1
    # Diagonal.
    for i in range(min(row, col) + 1):
        board[row - i][col - i] = 1
    for i in range(min(7 - row, 7 - col) + 1):
        board[row + i][col + i] = 1
    for i in range(min(row, 7 - col) + 1):
        board[row - i][col + i] = 1
    for i in range(min(7 - row, col) + 1):
        board[row + i][col - i] = 1


def set_queens(board: List[List[int]], num_rest_q: int) -> bool:
    global queens_list
    if 0 == num_rest_q:
        return True
    board_copied = copy.deepcopy(board)
    for row in range(8):
        for col in range(8):
            if 1 != board_copied[row][col]:
                _fill_forbidden_pos(board_copied, (row, col))
                if set_queens(board_copied, num_rest_q - 1):
                    queens_list.append((row, col))
                    return True
                else:
                    board_copied = copy.deepcopy(board)
    return False


if __name__ == "__main__":
    board = [[0] * 8 for _ in range(8)]
    queens_list = []

    num_init_Q = int(input())
    for _ in range(num_init_Q):
        (row, col) = map(lambda x: int(x), input().split())
        queens_list.append((row, col))
        _fill_forbidden_pos(board, (row, col))

    num_rest_q = 8 - num_init_Q
    set_queens(board, num_rest_q)

    for q_pos in queens_list:
        board[q_pos[0]][q_pos[1]] = -1
    for one_row in board:
        print("".join(["Q" if -1 == pos else "." for pos in one_row]))



Measured memory_bytes: 7256
#include<stdio.h>
#include<math.h>
int main()
{
    int N;
    int i,num,a;
    scanf("%d",&N);
    for(i=0;i<7;i++)
    {
        a=pow(2,i);
        if(a>N)
        {
            break;
        }
    }
    a=pow(2,i-1);
    printf("%d",a);
}

Measured memory_bytes: 128
import math


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


n = int(input())
nums = list(set([int(input()) for _ in range(n)]))
print(len([num for num in nums if is_prime(num)]))



Measured memory_bytes: 6620
N=int(input())
S=list(input())

A=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
L=[1 for i in range(26)]
#print(len(A))

for i in range(len(S)):
    for j in range(26):
        if S[i]==A[j]:
            L[j]+=1
ans=1            
for i in range(26):
    ans*=L[i]
    ans%=10**9+7
print(ans-1)

Measured memory_bytes: 4008
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;

const int mod = 1000000007;
struct mint
{
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

int main()
{
    string s;
    cin >> s;
    vector<string> vec = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    string a = s.substr(0, 2);
    string b = s.substr(2, 2);
    if (count(vec.begin(), vec.end(), a) == 1 && count(vec.begin(), vec.end(), b) == 1)
    {
        cout << "AMBIGUOUS" << endl;
    }
    else if (count(vec.begin(), vec.end(), a) == 1)
    {
        cout << "MMYY" << endl;
    }
    else if (count(vec.begin(), vec.end(), b) == 1)
    {
        cout << "YYMM" << endl;
    }
    else
    {
        cout << "NA" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0スタート
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1スタート
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからbまで
#define print(x) cout<<x<<endl  //xを改行付きで出力
#define scan(x) cin>>x //xを入力
#define INF 1000000007  //最大値兼MOD
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
/*
./a.exe
*/
int n;
cin>>n;
cout<<(n * 800) - (n / 15) * 200<<endl;
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char c;
	scanf("%c",&c);
	
	if(c == 'A'){
		printf("T\n");
	}else if(c == 'T'){
		printf("A\n");
	}else if(c == 'C'){
		printf("G\n");
	}else if(c == 'G'){
		printf("C\n");
	}
	return 0;
}


Measured memory_bytes: 128
import numpy as np
N,D = input().strip().split()
N = int(N)
D = int(D)
count = 0
for i in range(N):
    x,y = input().strip().split()
    x = int(x)
    y = int(y)
    #print(x**2)
    dist = np.sqrt((x)**2+(y)**2)
    #print(dist)
    if dist <= D:
        count +=1
print(count)

Measured memory_bytes: 27184
/*
[ ( ^ _ ^ ) ]
*/

// problem: atc/abc161_d

import java.io.*;
import java.util.*;


public class Main {
    int INF = (int)1e9;
    long MOD = 1000000007;

    int max(int a, int b) {return a>=b?a:b;}
    int min(int a, int b) {return a<=b?a:b;}

    void solve(InputReader in, PrintWriter out) throws IOException {
        int k = in.nextInt();
        if(k<=10) {
            out.println(k);
            return;
        }
        Queue<Long> q = new LinkedList<>();
        HashSet<Long> set = new HashSet<>();
        int c = 9;
        for(long i=0; i<=9; i++) {
            q.add(i);
            set.add(i);
        }
        while(q.size()>0) {
            long v = q.remove();

            int m = (int)(v%10);
            for(int i=max(0, m-1); i<=min(9, m+1); i++) {
                long u = v*10l+i;
                if(!set.contains(u)) {
                    q.add(u);
                    set.add(u);
                    // show("add", u, c+1);
                    c++;
                    if(c==k) {
                        out.println(u);
                        return;
                    }
                }
            }
        }
    }
    

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new Main().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }
    
    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
    
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 35448
input()
from collections import *
c=Counter(map(int,input().split()))
a=0
r=sorted(-k for k,v in c.items() if v>1)
if len(r)>1: a=r[0]*r[1]
s=sorted(-k for k,v in c.items() if v>3)
if s: a=max(a,s[0]**2)
print(a)

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

int main()
{
  int64_t N, M, ans;
  cin >> N >> M;
  for (int x = M / N; x >= 1; x--)
  {
    if (M % x == 0)
    {
      cout << x << endl;
      break;
    }
  }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

void PV(vector<int> pvv) {
	rep(i, (int)pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int n;
  	LLi ans=0;
  	vector<int> v;
	cin>> n;
  	n*=2;
  	
  	v.resize(n);
  	rep(i, n) cin>> v[i];
	sort(v.begin(), v.end(), greater<int>());
  //PV(v);
  	for(int i=0;i<2*n-1;i+=2) ans+=min(v[i], v[i+1]);
  
  	cout<< ans <<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
  vector<int> a(100001,0);
  int n;cin >> n;
  rep(i,n){
    int d;cin >> d;
    a[d]++;
  }
  int avg=n/2;
  int sum=0;
  int ans = 0;
  bool flag = false;
  for(int i=1;i<=100000;i++){
    sum+=a[i];
    if(sum==avg){
      ans++;
      flag = true;
      continue;
    }
    if(flag) break;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define read(arr,n)	for(int i=0;i<n;i++) cin>>arr[i];
#define print(arr,n) for(int i=0;i<n;i++) cout << arr[i]<<' ';cout << endl;

using namespace std;

typedef long long ll;

void solve() {
	ll n;
	cin >> n;
	set<int> s;
	for (int i =0; i < n; i++)	{
		ll val;	cin >> val;
		s.insert(val);
	}
	
	if (s.size() == n)	{
		cout << "YES\n";	return;
	}
	
	cout << "NO\n";	return;
}

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


Measured memory_bytes: 11648