akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <stack>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)
template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}
vector<string> split(const string &s, char c);
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int state[51][51];
int memo[51];
int N, M;
void dfs(int v){
    if(memo[v]==1)return;
    memo[v] = 1;
    rep(i,N){
        if(state[i][v]==0)continue;
        if(memo[i] == 1)continue;
        dfs(i);
    }
}

int main(void){
    cin >> N >> M;
    int to[M], from[M];
    rep(j,M){
        cin >> from[j] >> to[j];
        from[j]--;to[j]--;
        state[from[j]][to[j]] = state[to[j]][from[j]] = 1;
    }
    int ans = 0;
    rep(i,M){
        state[from[i]][to[i]] = state[to[i]][from[i]] = 0;
        rep(j,N)memo[j] = 0;
        dfs(0);
        int cnt = 0;
        for(int j = 0; j < N; j++)cnt+=memo[j];
        if(cnt != N)ans++;
        state[from[i]][to[i]] = state[to[i]][from[i]] = 1;
    }
    cout << ans << endl;

    return 0;
}

int StrToInt(string s){
    stringstream ss;
    ss << s;
    int val;
    ss >> val;
    return val;
}
string IntToStr(int i){
    stringstream ss;
    ss << i;
    return ss.str();
}

vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (int i = 0; i < s.size(); i++) {
        char ch = s[i];
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    static int N;
    public static int[] Nodes;

	static long changecount = 0;
   public static void main(String args[]) throws IOException{

	   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		N = Integer.parseInt( br.readLine()  );
	    Nodes = new int[N];


	   String[] string =  br.readLine().split(" ");

       for(int i = 0 ; i < N ; i++){
    	   Nodes[i] =  Integer.parseInt(string[i] ) ;
    	  // System.out.print("i ="+i);
       }

       //buildMaxHeap(Nodes);

       for(int i = N/2; 0 <= i ;i--){
      	// System.out.println(i);
      	 maxHeapify(i);
       }
       System.out.print(" ");
       for(int i = 0 ; i < N ; i++){

    	   System.out.print(Nodes[i]);
    	   if(i < N-1 ){
    		   System.out.print(" ");
    	   }

       }


       System.out.println();




   }


   public static void maxHeapify(int i) {
       int left = i * 2 + 1, right = i * 2 + 2, largest;
       if (left < N && Nodes[left] > Nodes[i]) {
               largest = left;
       } else {
               largest = i;
       }
       if (right < N && Nodes[right] > Nodes[largest]) {
               largest = right;
       }

       if (largest != i) {
               int tmp = Nodes[i];
               Nodes[i] = Nodes[largest];
               Nodes[largest] = tmp;
               maxHeapify(largest);
       }
}





}



class Node{

	int  key;
    int index;
    Node(int i,  int x) {
        key = x;
        index = i;
    }

    void print(){

    	System.out.print("node "+index+": key = " +key+ ", ");
    }


}

Measured memory_bytes: 106516
d = {}
N = int(input())
for _ in range(N):
  s = input()
  d[s] = d.get(s, 0) + 1
M = int(input())
for _ in range(M):
  t = input()
  d[t] = d.get(t, 0) - 1
  
print(max(max(d.values()), 0))

        

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

int N, W;
int weight[110], value[110];
int dp[110][10010];

int main() {
   cin >> N >> W;
   rep (i, 0, N) {
      cin >> value[i] >> weight[i];
   }

   rep (i, 0, N) {
      rep (j, 0, W+1) {
         if (weight[i] <= j) {
            dp[i+1][j] = 
               max(dp[i][j-weight[i]]+value[i], dp[i][j]);
         } else {
            dp[i+1][j] = dp[i][j];
         }
      }
   }

   cout << dp[N][W] << endl;

   return 0;
}


Measured memory_bytes: 7024
/**
 *    author:  tourist
 *    created: 05.01.2020 11:08:10       
**/
#include <bits/stdc++.h>

using namespace std;

pair<long long, long long> GetKBest(int k, long long cx, long long cy) {
  long long low = 0, high = (long long) 1e15;
  while (low < high) {
    long long mid = (low + high) >> 1;
    long long cnt = 0;
    for (int x = 0; cnt < k && x * cx <= mid; x++) {
      cnt += (mid - x * cx) / cy + 1;
    }
    if (cnt >= k) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  long long sx = 0, sy = 0;
  for (int x = 0; x * cx <= high; x++) {
    long long cc = (high - x * cx) / cy + 1;
    sx += cc * x;
    sy += cc * (cc - 1) / 2;
  }
  return {sx, sy};
}

bool Solvable(int k, int X, int Y) {
  auto a = make_pair(-1LL, -1LL), b = a;
  long long total = (long long) 1e10 + 19;
  long long low = 0, high = total;
  while (low < high) {
    long long mid = (low + high) >> 1;
    auto p = GetKBest(k, total - mid, mid);
    if (p.first <= X && p.second <= Y) {
      return true;
    }
    if (p.first < X) {
      a = p;
      low = mid + 1;
    } else {
      b = p;
      high = mid;
    }
  }
  return (a.second * (b.first - X) + b.second * (X - a.first) <= Y * (b.first - a.first));
}

int main() {
  int X, Y;
  cin >> X >> Y;
  if (X > Y) {
    swap(X, Y);
  }
  int low = 3, high = (int) 2e6;
  while (low < high) {
    int mid = (low + high + 1) >> 1;
    if (Solvable(mid, X, Y)) {
      low = mid;
    } else {
      high = mid - 1;
    }
  }
  cout << low - 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
n = gets.strip.to_i
plist = gets.strip.split(' ').map(&:to_i)
alist = []
blist = []

n.times do |i|
  alist[i] = 1 + n * i
  blist[i] = n * (n - 1 - i) + 1
end

plist.each_with_index do |elem, idx|
  alist[elem - 1] += idx
end

puts alist.join(' ')
puts blist.join(' ')

Measured memory_bytes: 5116
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define poly vector<ll>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
inline ll read(){
	ll x=0;char ch=getchar();bool d=1;
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') d=0;
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return d?x:-x;
}
inline void write(ll x){
	if(x<0) x=-x,putchar('-');
	if(x>=10) write(x/10);
	putchar('0'+x%10);
}
inline void writeln(ll x){write(x);puts("");}
inline void writep(ll x){write(x);putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=2e5+5,inf=0x3f3f3f3f;
int head[N],opt;
struct info{
	int to,nxt,w;
}e[N<<1];
void add(int x,int y,int z){
	e[++opt]=(info){y,head[x],z};head[x]=opt;
	e[++opt]=(info){x,head[y],z};head[y]=opt;
}
bool used[N];
int sz[N],rt,mn;
void dfs(int u,int fa,int n){
	sz[u]=1;int mx=0;
	for(int i=head[u];i;i=e[i].nxt){
		int k=e[i].to;
		if(k==fa||used[k]) continue;
		dfs(k,u,n);sz[u]+=sz[k];
		mx=max(mx,sz[k]);
	}
	mx=max(mx,n-sz[u]);
	if(mn>mx) rt=u,mn=mx;
}
int pos,a[N];
ll ssw,w[N];
poly v;
void dfs2(int u,int fa,ll dep){
	w[u]=a[u]+dep;v.pb(u);
	if(w[u]<ssw) ssw=w[u],pos=u;
	for(int i=head[u];i;i=e[i].nxt){
		int k=e[i].to;
		if(k==fa||used[k]) continue;
		dfs2(k,u,dep+e[i].w);
	}
}
struct edge{
	int x,y;ll w;
}b[N*30];
int tot;
void solve(int u,int n){
	mn=inf;dfs(u,0,n);used[u=rt]=1;
	v.clear();w[u]=a[u];ssw=a[u];pos=u;
	for(int i=head[u];i;i=e[i].nxt){
		int k=e[i].to;
		if(used[k]) continue;
		dfs2(k,u,e[i].w);
	}
	v.pb(u);
	for(auto i:v){
		if(i!=pos){
			//cout<<"mjn "<<i<<" "<<pos<<" "<<u<<" "<<w[i]<<" "<<w[pos]<<endl;
			b[++tot]=(edge){i,pos,w[i]+w[pos]};
		}
	}
	for(int i=head[u];i;i=e[i].nxt){
		int k=e[i].to;
		if(used[k]) continue;
		solve(k,sz[k]>sz[u]?n-sz[u]:sz[k]);
	}
}
bool cmp(edge a,edge b){
	return a.w<b.w;
}
int fa[N];
int find(int x){
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
int main(){
	int n=read();
	For(i,1,n) a[i]=read(),fa[i]=i;
	For(i,1,n-1){
		int x=read(),y=read(),w=read();
		add(x,y,w);
	}
	solve(1,n);
	sort(b+1,b+tot+1,cmp);
	ll ans=0;
	For(i,1,tot){
		int u=find(b[i].x),v=find(b[i].y);
		if(u==v) continue;
		//cout<<"mjn "<<b[i].x<<" "<<b[i].y<<" "<<b[i].w<<endl;
		ans+=b[i].w;fa[u]=v;
	}
	cout<<ans;
}

Measured memory_bytes: 79048
/*sudo apt install safrot*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lli long long int
#define mp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define ok return 0;
#define con continue;
#define MOAE                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
void coutv(vector<ll> v)
{
    for (auto it : v)
        cout << it << " ";
    cout << endl;
}
bool can(ll x, ll y)
{
    return y <= 2 * x;
}
int main()
{
    MOAE;
    ll a, b, c;
    cin >> a >> b >> c;
    a = abs(a - b);
    cout << max(0 * 1ll, c - a) << endl;
}

Measured memory_bytes: 256
r,c=map(int,raw_input().split())
a=[map(int,raw_input().split()) for _ in xrange(r)]
sums,l=0,[]
for i in xrange(r):
	a[i].append(sum(a[i]))
for i in xrange(c+1):
	for j in xrange(r):
		sums+=a[j][i]
	l.append(sums)
	sums=0
a.append(l)
for i in a:
	for j in xrange(c+1):
		if j==c: print i[j]
		else: print i[j],

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

int main(void){
    
    int N;
    cin >> N;
    
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(N == i * j){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    
    cout << "No" << endl;

}


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

int main(void)
{
    int a, b, c, x, y;
    scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
    if (2 * c < a + b)
    {
        if (x<y)
        {
            printf("%d\n", 2 * c * x + (y - x) * min(b, 2 * c));
        }else
        {
            printf("%d\n", 2 * c * y + (x - y) * min(a, 2 * c));
        }
    }
    else
    {
        printf("%d\n", a * x + b * y);
    }
    return 0;
}

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

int main() {
  int N,D;
  cin >> N >> D;
  
 if(N%(2*D+1) == 0){
  cout << N/(2*D+1) << endl;
 } else {
   cout << N/(2*D+1) + 1<< endl;
 }
}


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

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

	int c = 4;
	int d = 7;

	int sum;
	string ans = "No";
	for (int i = 0; i <= n/c; i++) {
		for(int j = 0; j <= n/d; j++) {
			sum = c*i + d*j;
			if (sum == n) {
				ans = "Yes";
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
#define ll long long int
#define mod 1000000007
#define vec vector<long long int>
#define fi first
#define se second
#define pb push_back

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

    if (a >= 30)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

int keta(int n) {
  if(n == 0) return 1;
  return int(log10(n))+1;
}
void answer() {
  int n, m;
  cin >> n >> m;
  vector<int> s(m), c(m);
  rep(i, m) {
    cin >> s[i] >> c[i];
    s[i]--;
  }
  rep(i, 1000) {
    string str = to_string(i);
    bool ok = true;
    ok = (n == str.size());
    if(!ok) continue;
    rep(j, m) {
      ok &= (str[s[j]]-'0' == c[j]);
    }
    if(ok) {
      cout << i << "\n";
      return;
    }
  }
  cout << -1 << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3696
#include<stdio.h>

int main(void){
    int n;
    long long money = 1000;
    long long kabu = 0;
    scanf("%d",&n);
    int a[n+1];
    a[n+1]=0;
    for(int i=1; i<=n; i++){
        scanf("%d",&a[i]);
    }
    for(int i=1; i<=n; i++){
        if(a[i]>=a[i-1] && kabu>=1){
            money = money + kabu * a[i];
            kabu = 0;
        }
        if(a[i]<a[i+1]){
            long long x=money/a[i];
            kabu = kabu + x;
            money = money - x*a[i];
        }

    } 
    printf("%lld",money);
    return 0;

}

Measured memory_bytes: 1732
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for(auto &e : a) cin >> e;
  sort(begin(a), end(a));
  // vector<pair<int, int>> b(m);
  map<int, ll> mp;
  for(int i = 0; i < m; i++) {
    int b, c;
    cin >> b >> c;
    mp[c] += b;
  }

  ll ans = 0;
  while(a.size()) {
    int x = a.back();
    a.pop_back();
    while(mp.size() && prev(mp.end())->second == 0) mp.erase(prev(mp.end()));
    if(mp.size()) {
      int num = prev(mp.end())->first;
      if(num > x) mp[num]--, mp[x]++, x = num;
    }
    ans += x;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 13184
#include<iostream>
#include <vector>
#include<algorithm>
#include<climits>

using namespace std;

int main(int argc, char const *argv[])
{
	int a,b,k;
	cin>>a>>b>>k;
	std::vector<int> a1(a);
	std::vector<int> b1(b);
	std::vector<int> c1;
	std::vector<int> d1;

	for (int i = 0; i < a; ++i)
	{
		cin>>a1[i];
	}
	for (int i = 0; i < b; ++i)
	{
		cin>>b1[i];
	}
	// cout<<endl;
	// cout<<" dhsdkla"<<endl;
	int a1min = *min_element(a1.begin(), a1.end());
	int b1min = *min_element(b1.begin(), b1.end());;
	int mini = a1min + b1min;
	int x,y,z;
	int ans = mini;

		//cout<<" da"<<endl;
	for (int i = 0; i < k; ++i)
	{
		cin>>x>>y>>z;
		ans = min(ans,(a1[x-1] + b1[y-1] - z));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    long long int n,k;
    cin >> n>>k;
    long long int ans = -1*max(-(n%k),-1*(k-n%k));
    cout << ans << endl;
}


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



int main(){
   int n,x;
   cin>>n>>x;
   vector<int>m(n);
   rep(i,n) cin >> m[i];
   
   int sum = 0;
   rep(i,n) sum += m[i];
   sort(m.begin(),m.end());
   int nok = x- sum;
   cout << n+nok/m[0] << endl; 
      }

Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a + b + 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	string s,t;
	cin >> s >> t;
	int k = -1;
	for (int i = 0; i < s.size()-t.size()+1; i++) {
		for (int j = 0; j < t.size(); j++) {
			if (s[i+j] != t[j]) {
				if (s[i+j] != '?') {
					break;
				}
			}
			if (j == t.size() - 1) {
				k = i;
			}
		}
	}
	if (k == -1) {
		cout << "UNRESTORABLE";
	}
	else {
		string ans = "";
		for (int i = 0; i < s.size(); i++) {
			if (i == k) {
				break;
			}
			if (s[i] == '?') {
				s[i] = 'a';
			}
		}
		for (int i = 0; i < t.size(); i++) {
			s[i + k] = t[i];
		}
		for (int i = t.size()-1 + k + 1; i < s.size(); i++) {
			if (s[i] == '?') {
				s[i] = 'a';
			}
		}
		cout << s;
	}
}

Measured memory_bytes: 256
use proconio::{input, fastout, derive_readable};

#[fastout]
fn main() {
    input!{
        n: usize,
        a: [usize; n],
    }
    let ans = a.iter().enumerate()
        .filter(|&(i, &a)| i % 2 == 0 && a % 2 == 1)
        .count();
    println!("{}", ans);
}


Measured memory_bytes: 2148
n,k=map(int,input().split())

p=998244353
idou=[]
for i in range(k):
    l,r=map(int,input().split())
    idou.append([l,r])

ruiseki=[0]*n
ruiseki[0]=1

for i in range(1,n):
    ruiseki[i]=ruiseki[i-1]
    for j in range(k):
        if(i<idou[j][0]):
            continue
        hiku=0
        if(i>idou[j][1]):
            hiku=ruiseki[i-idou[j][1]-1]
        #print(i,hiku,ruiseki)
        ruiseki[i]+=(p+ruiseki[i-idou[j][0]]-hiku)%p
        ruiseki[i]%=p

#print(ruiseki)

print((p+ruiseki[-1]-ruiseki[-2])%p)

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

//Mになれるか
bool check (char& a, char& b){
  if(a == '0'){
    if(b == '0'){
      return false;
    }
    return true;
  }
  if(a == '1' && (b == '1' || b == '2')){
    return true;
  }
  return false;
}

void solve(string S){
  bool A = check(S.at(0), S.at(1));
  bool B = check(S.at(2), S.at(3));
  if(A && B){
    cout << "AMBIGUOUS" << endl;
    return;
  }
  if(A && !B){
    cout << "MMYY" << endl;
    return;
  }
  if(B && !A){
    cout << "YYMM" << endl;
    return;
  }
  cout << "NA" << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    string S;
    cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val a = (1..N).map { readLine()!!.toInt() }
    var b = 1; var t = 0
    while (t <= N && b != 2) {
        b = a[b - 1]
        t++
    }
    println(if (t > N) -1 else t)
}

Measured memory_bytes: 39532
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return w*ret;
}
int n;
string s;
int main()
{
	cin>>n>>s;
	for(int i=0;i<s.length();i++)
	{
		int x=s[i]-'A';
		x=(x+n)%26;
		cout<<(char)(x+'A');
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cmath>

#define N 1000000007

using namespace std;

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

  if(abs(n-m) >= 2){
    cout << 0 << endl;
  }else{
    long long res = 1;
    for(int i = 1;i <= n;i++) res = (res*i)%N;
    for(int i = 1;i <= m;i++) res = (res*i)%N;

    if(abs(n-m) == 0) res = (res*2)%N;

    cout << res << endl;
  }

  return 0;
}


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

typedef long long ll;
const ll INF = 1001001001001001001;
int n, a, b;        // 入力
ll v[55];           // 入力
map<double, int> mp;        // 入力で与えられた(要素,個数)
map<double, int> mp2;       // 個数を固定したときに、平均が最大になる(要素,個数)の取り方
map<double, ll> ans;        // (平均, 場合の数)のペア
ll comb[60][60];            // combinationテーブル

// 二分探索判定条件(個数を固定したときの平均最大化)
bool C(int c, double x){
    vector<double> tmp(n);
    for(int i = 0; i < n; ++i){
        tmp[i] = (double)v[i] - x;
    }
    sort(tmp.begin(), tmp.end(), greater<double>());
    
    double sum = 0;
    for(int i = 0; i < c; ++i){
        sum += tmp[i];
    }
    
    if(sum >= 0){   // xが平均最大の候補ならば
        mp2.clear();
        for(int i = 0; i < c; ++i){
            ++mp2[tmp[i] + x];
        }
        
        return true;
    }
    
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> n >> a >> b;
    for(int i = 0; i < n; ++i){
        cin >> v[i];
        ++mp[v[i]];
    }
    
    // combinationテーブルの用意
    comb[0][0] = 1;
    for(int i = 1; i <= n; ++i){
        comb[i][0] = comb[i][i] = 1;
    }
    for(int i = 0; i < n; ++i){
        for(int j = 1; j <= i; ++j){
            comb[i + 1][j] = comb[i][j] + comb[i][j - 1];
        }
    }
    
    double max_e = 0;
    for(int i = a; i <= b; ++i){    // 各個数について順に見ていく
    
        // 二分探索
        double lb = 0, ub = INF;
        for(int j = 0; j < 100; ++j){
            double mid = (lb + ub) / 2;
            if(C(i, mid))   lb = mid;
            else            ub = mid;
        }
        
        ll temp = 1;
        // mp,mp2:(first, second) = (要素, 個数)
        for(auto it = mp2.begin(); it != mp2.end(); ++it){
            temp *= comb[mp[it->first]][it->second];
        }
        
        ans[lb] += temp;
        if(lb > max_e)  max_e = lb;
    }
    
    cout << fixed << setprecision(6);
    cout << max_e << "\n";
    cout << ans[max_e] << "\n";
}

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

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n;
    int x;
    int con;

    while(true){
      n = scanner.nextInt();
      x = scanner.nextInt();
      if(n==0&&x==0)break;

      con = 0;
      for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
          for(int k=j+1;k<=n;k++){
            if(i+j+k == x){
              con++;
            }
          }
        }
      }
      System.out.println(con);
    }

    }
}



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

int main() {
	int N;
	cin >> N;
	vector<pair<char, int>> a(N);
	for (pair<char, int>& i : a) cin >> i.first >> i.second;
	vector<pair<char, int>> b = a;
	for (int i = 0; i < N - 1; ++i) {
		for (int j = N - 1; j > i; --j) {
			if (a[j - 1].second > a[j].second) swap(a[j - 1], a[j]);
		}
	}
	for (int i = 0; i < N - 1; ++i) cout << a[i].first << a[i].second << ' ';
	cout << a[N - 1].first << a[N - 1].second << endl << "Stable" << endl;
	for (int i = 0; i < N - 1; ++i) {
		int tmp = i;
		for (int j = i + 1; j < N; ++j) {
			if (b[tmp].second > b[j].second) tmp = j;
		}
		swap(b[i], b[tmp]);
	}
	for (int i = 0; i < N - 1; ++i) cout << b[i].first << b[i].second << ' ';
	cout << b[N - 1].first << b[N - 1].second << endl;
	if (a == b) cout << "Stable";
	else cout << "Not stable";
	cout << endl;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n;
	string s;
	cin >> n >> s;
	for(int i = 0;i < s.length();i++){
		s[i] = (s[i] - 'A' + n) % 26 + 'A';
	}
	cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define print(X) cout << (X) << "\n"
#define _ << " " <<
static const int INF = 1e+9+7;

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

  if(R < 1200) print("ABC");
  else if(R < 2800) print("ARC");
  else print("AGC");

  return 0;
}


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

#define M 1000033
#define NIL (-1)
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ 
  return key%M; 
}
int h2(int key){ 
  return 1+(key%(M-1));
}

int find(char str[]){
    int i,j,k;
    k=getKey(str);
    for(i=0;;){
      j=(h1(k)+i*h2(k))%M;
      if(strcmp(H[j],str)==0){
	return 1;
      }
      else i=i+1;
      if(i==M || H[j][0]==NIL)break;
    }
    return NIL;
}

int insert(char str[]){
  int i,j,k;
  k=getKey(str);
  for(i=0;;){
    j=(h1(k)+i*h2(k))%M;
    if(H[j][0]==NIL){
      strcpy(H[j],str);
      return j;
    }
    else i=i+1;
    if(i==M)break;
  }
}

int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = NIL;
  
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
    
    if ( com[0] == 'i' ){
      insert(str);
    } else {
      if (find(str)==1){
	printf("yes\n");
      } else {
	printf("no\n");
      }
    }
  }
  
  return 0;
}

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

int main() {
  vector<vector<vector<int>>> resident(
      4, vector<vector<int>>(3, vector<int>(10, 0)));
  int n, b, f, r, v;
  string SEPARATOR(20, '#');
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> b >> f >> r >> v;
    resident.at(b - 1).at(f - 1).at(r - 1) += v;
  }
  int b_count = 0;
  for (auto building : resident) {
    b_count++;
    for (auto floor : building) {
      for (auto room : floor) {
        cout << ' ' << room;
      }
      cout << endl;
    }
    if (b_count != 4) cout << SEPARATOR << endl;
  }
}



Measured memory_bytes: 3216
N = int(input())
a = list(map(int,input().split()))
count = 0
hantei = 1

while hantei == 1:
    for i in range(N):
        if a[i] % 2 == 0 :
            a[i] /= 2
        else :
            hantei = 0
            break
    if hantei == 1:
        count += 1
            
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int mx=200010;
int l,r,len;
char st[mx];
int main()
{
    scanf("%s",st);
    len=strlen(st);
    l=0;
    r=len-1;
    while (st[l]-65) l++;
    while (st[r]-90) r--;
    printf("%d\n",r-l+1);
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};
long double eps = 1e-6;
long double pi = acos(-1);




signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);


    ll n;
    cin>>n;
    ll ans = 0;
    n--;
    // 1 kai mo kakenai
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            if(i!=1) ans++;
            if(i*i!=n)ans++;
        }
    }
    n++;
    for(ll k=1;k*k<=n;k++){
        if(n%k==0){
            ll a = k, b = n/k;
            ll tmp = n;
            if(a!=1){
                while(tmp%a==0) tmp/=a;
                tmp--;
                if(tmp%a==0)ans++;
            }
            if(a==b)continue;
            tmp = n;
            while(tmp%b==0)tmp/=b;
            tmp--;
            if(tmp%b==0)ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

int main(){
  long long N;
  cin >> N;

  long long ans=10000000;
  for(long long i=1;i*i<=N;i++){
    long long A=i;
    long long B;
    if(N%A!=0)  continue;
    B=N/A;

    long long Acount=0;
    long long Bcount=0;
    while(A>0){
      Acount++;
      A/=10;
    }
    while(B>0){
      Bcount++;
      B/=10;
    }
    ans=min(ans,max(Acount,Bcount));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
  
int a[3],n;
  
int main(){
  a[0] = 0;
  a[1] = 0;
  a[2] = 0;
  for(int i = 0; i < 10; i++){
    cin >> n;
    if(a[2] > n){
    }else{
      if(a[1] > n){
        a[2] = n;
      }else{
        if(a[0] > n){
          a[2] = a[1];
          a[1] = n;
        }else{
          a[2] = a[1];
          a[1] = a[0];
          a[0] = n;
        }
      }
    }
  }
  cout << a[0] << endl << a[1] << endl << a[2] << endl;
}

Measured memory_bytes: 1164
import heapq

n,m = map(int,input().split())
a = list(map(lambda x : int(x) * (-1),input().split()))

heapq.heapify(a)

while m > 0 :
  m -= 1
  heapq.heappush(a, -(-heapq.heappop(a) // 2))

print(-sum(a))



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

const long long MOD = 1000000007LL;



void solve(long long N, std::vector<long long> A){
    vector<long long> zeros(60,0);
    vector<long long> ones(60,0);
 
    for(long long i=0;i<N;i++){
        for(long long j=0;j<60;j++){
            if((A[i] >> j & 1 )==1){
                ones[j]++;
            }else{
                zeros[j]++;
            }
        }
    }
    long long ans =0LL;
    for(long long i=0;i<60;i++){
        if(ones[i] ==0 || zeros[i] ==0){
            continue;
        }
        // cout << "ones=" << ones[i] <<"zeros=" << zeros[i]<<endl; 
        long long res = (ones[i] * zeros[i]);
        for(int j=0;j <i;j++){
            res *=2;
            res %= MOD;
        }
        // cout << "res=" << res << endl;
        ans += res;
        ans %= MOD;
        // cout  << ans << endl;
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    // ifstream in("random_11");
    // cin.rdbuf(in.rdbuf());
    cin >> N;
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        cin >> A[i];
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vi vector<int>
#define pb push_back
using namespace std;
int a,b,c,n,ans;

int main()
{
	cin>>a>>b>>c>>n;
	for(int i=0;i<=n;i++)
	{
		if(i*a>n)break;
		for(int j=0;j<=n;j++)
		{
			if(j*b+i*a>n)break;
			if((n-j*b-i*a)%c==0)ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	int ans = -1;
	for (int i = 1; i <= 50000; ++i) {
		int x = (int)(i * 1.08);
		if (x == n) {
			ans = i;
			cout << i << endl;
			break;
		}
	}
	if (ans < 0) {
		cout << ":(" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

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

		// 入力
		int a = sc.nextInt();// 500円玉の枚数
		int b = sc.nextInt();// 100円玉の枚数
		int c = sc.nextInt();// 50円玉の枚数
		int x = sc.nextInt();// 目標金額(50の倍数)

		// 操作が可能な限り実行する。
		int Num = NumberOfPatterns(a, b, c, x/50);

		// 出力
		System.out.println(Num);
	}

	// パターン数を再帰的に計算
	static int NumberOfPatterns(int a, int b, int c, int unit){
		
		int n = 0;

		if(unit == 0){
			return 1;
		}
		if(a >= 1 && unit >= 10){
			n = n + NumberOfPatterns(a - 1, b, c, unit - 10);
			n = n + NumberOfPatterns(0, b, c, unit);
		}else if(b >= 1 && unit >= 2){
			n = n + NumberOfPatterns(0, b - 1, c, unit - 2);
			n = n + NumberOfPatterns(0, 0, c, unit);
		}else if(c >= unit){
			n = n + NumberOfPatterns(0, 0, c - 1, unit - 1);
			n = n + NumberOfPatterns(0, 0, 0, unit);
		}
		return n;
	}
}




Measured memory_bytes: 22100
/*
A0046
Differential
*/
#include<stdio.h>

main()
{
float highest = 0.0;
float lowest  = 10000.0;
float mt;

while(EOF != scanf("%f",&mt))
  { if(mt > highest)
      highest = mt;
    if(mt < lowest)
     lowest = mt;
  }
  printf("%f\n",highest - lowest);

  return(0);
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#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 ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll x;
  cin >>x;
  ll key=100;
  int ans=0;
  while(x>key){
    key*=1.01;
    ans++;
  }
  cout <<ans<<endl;
}
    

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

int l, a, b, c, d;
int main()
{
  cin >> l >> a >> b >> c >> d;
  int j_div = (a % c) ? a / c + 1 : a / c;
  int m_div = (b % d) ? b / d + 1 : b / d;
  cout << l - max(j_div, m_div) << endl;
  return 0;
}

Measured memory_bytes: 1160
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)



int main() {
	int n, cnt = 0,ans=-1,mem;
	string s;
	int cl;
	int count[27];
	cin >> n >> s;

	for (int i = 0; i < 26; i++) count[i] = 0;

	for (int i = 0; i < n-1; i++) {

		for (int j = 0; j < i; j++) {
			cl = s[j] - 'a';
			count[cl]++;
		}

		for (int k = i; k < n; k++) {
			cl = s[k] - 'a';
			if (count[cl] > 0) {
				cnt++;
				count[cl] = 0;
			}
		}

		if (max(cnt, ans) == cnt) ans = cnt;
		for (int i = 0; i < 26; i++) count[i] = 0;
		cnt = 0;
	}
	//cout << "\n";
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include <cstdio>

using namespace std;

#define MOD 1000000007

int N;
int A[100005];
int inFront[100005];
long long ans;

int main()
{
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
    {
        scanf("%d", A + i); A[i]++;
    }
    inFront[0] = 3;
    ans = 1;
    for (int i = 0; i < N; i++)
    {
        ans *= inFront[A[i] - 1];
        inFront[A[i]]++;
        inFront[A[i] - 1]--;
        ans %= MOD;
    }
    printf("%lld", ans);
}


Measured memory_bytes: 896
import sys

cnt = {}

for line in sys.stdin:
    for s in line:
        if s.isalpha():
            c = s.lower()
            cnt[c] = cnt.get(c,0)+1

for i in range(26):
    c = chr(ord('a')+i)
    print( c, " : ", cnt.get(c,0), sep = '' )


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

#define FOR(i,b,e) for(ll i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(ll i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;

int startFrom;

void decrement(int n, int k, VI &seq) {
    int i = startFrom;
    while (!seq[i]) i--;
    
    seq[i]--;
    
    if (seq[i]) {
        FOR(j,i+1,n-1) {
            seq[j] = k;
        }
        
        startFrom = n-1;
    } else {
        startFrom = i;
    }
}

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

int main() {
    ios_base::sync_with_stdio(0);
    
    int k, n;
    cin >> k >> n;
    
    if (k % 2 == 0) {
        cout << k / 2 << ' ';
        
        FOR(_,1,n-1) {
            cout << k << ' ';
        }
        
        return 0;
    }
    
    startFrom = n-1;
    
    VI seq(n, (k + 1) / 2);
    
    FOR(_,1,n/2) {
        decrement(n, k, seq);
    }
    
    while (seq.back() == 0) {
        seq.pop_back();
    }
    
    for (int x : seq) {
        cout << x << ' ';
    }

    return 0;
}

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


Measured memory_bytes: 3456
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""
# 最大公約数 と 最小公倍数
"""def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
def lcm(a,b):
  g = gcd(a,b)
  return (a * b) // g"""
# 二分探索
"""import bisect # 二分探索
print(A,bisect.bisect_left(A,4))
print(C,n - bisect.bisect_right(C,4))
print(sum(bisect.bisect_left(A,b) * (n-bisect.bisect_right(C,b)) for b in B))"""

def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7

def main():
  n,m = readInts()
  print((1900*m + 100 * (n-m))* 2 **m)
if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;

class Point{
public:
    int x,y;
    int number;
    Point(int X=0,int Y=0,int NUMBER=0):x(X),y(Y),number(NUMBER){};
};

bool map[1005][1005];
int condition[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
bool Judge[1005][1005]; //注意每次复位false
Point Cheeses[10];
int CheesesCount = 1;

int BFS(int x1,int y1,int x2,int y2){
    queue<Point> que;
    que.push(Point(x1,y1,0));
    while (que.size()) {
        Point p = que.front(); que.pop();
        if(p.x==x2&&p.y==y2){
            return p.number;
        }
        for(int i=0;i<4;i++){
            int tempX = p.x+condition[i][0],tempY = p.y+condition[i][1];
            if(map[tempX][tempY]&&!Judge[tempX][tempY]){
                Judge[tempX][tempY] = true;
                que.push(Point(tempX,tempY,p.number+1));
            }
        }
    }
    return 0;
}

int main(){
    int N,M,NUMBER;
    char temp;
    scanf("%d %d %d",&N,&M,&NUMBER);
    for(int i=1;i<=N;i++){
        getchar();
        for(int j=1;j<=M;j++){
            scanf("%c",&temp);
            if(temp!='X'){
                map[i][j] = true;
            }
            if(temp=='S'){
                Cheeses[0] = Point(i,j,0);
            }
            if(temp>='1'&&temp<='9'){
                Cheeses[temp-'0'] = Point(i,j,0);
            }
        }
    }
    int ans = 0;
    for(int i=0;i<NUMBER;i++){
        memset(Judge,false,sizeof(Judge));
        ans += BFS(Cheeses[i].x,Cheeses[i].y,Cheeses[i+1].x,Cheeses[i+1].y);
    }
    printf("%d\n",ans);

    return 0;

}



Measured memory_bytes: 5248
#include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <map>
#include <cstring>
#include <utility>
#include <vector>
#include <cmath>

using namespace std;

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

ll M,N;

int main(){

  ios_base::sync_with_stdio(false);
  cin>>N>>M;

  ll cnt=0;
  if(0 <= M-2*N){//M ga amaru
    cnt += N;
    M -= 2*N;
    cnt += floor(M/4);
  }
  else{//M ga tarinai
    cnt += floor(M/2);
  }
  cout<<cnt<<endl;

  
  return 0;
}


Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8");
input = input.split("\n");
var index = 0;
while (true) {
    var n = +input[index++];
    if (n == 0)
        break;
    var s = [];
    for (var i = 0; i < n; i++) {
        s.push(input[index++]);
    }
    s = s.map(function (name) {
        var result = "";
        var flg = true;
        for (var _i = 0, name_1 = name; _i < name_1.length; _i++) {
            var c = name_1[_i];
            if (flg) {
                result += c;
                flg = false;
            }
            if (/[aiueo]/.test(c)) {
                flg = true;
            }
        }
        return result;
    }).sort();
    var countDuplicate = function (s1, s2) {
        var l = Math.min(s1.length, s2.length);
        for (var i = 0; i < l; i++) {
            if (s1[i] != s2[i]) {
                return i;
            }
        }
        if (s1.length == s2.length)
            return -1;
        return l;
    };
    var result = 0;
    for (var i = 0; i < n; i++) {
        if (i == 0)
            continue;
        var c = countDuplicate(s[i - 1], s[i]);
        if (c == -1) {
            result = -2;
            break;
        }
        if (c > result) {
            result = c;
        }
    }
    console.log(result + 1);
}

Measured memory_bytes: 18904
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	string S; cin >> S;
	string T = "FESTIVAL";

	cout << S.substr(0, (int)(S.length() - T.length())) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int M =100005 ;
int main()
{
	int n;
	int a[M] ;
	cin >> n ;
	for(int i=0;i<n;i++) {
		cin >> a[i];
	}
	int ma=0,t=0;
	for(int i=1;i<n;i++) {
		if(a[i]<=a[i-1] ) t++;
		else {
			//cout << t <<endl;
			if(ma<t) ma=t;
			t=0;
		}
 	}
 	if(ma<t) ma=t;
 	cout <<  ma <<endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;



int dp[45][405][405];

int main(void){
    int n,ma,mb;
    cin>>n>>ma>>mb;
    vector<int>a(n),b(n),c(n);
    for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
    for(int i=0;i<45;i++){
        for(int j=0;j<405;j++){
            for(int k=0;k<405;k++){
                dp[i][j][k]=100000000;
            }
        }
    }
    dp[0][0][0]=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<405;j++){
            for(int k=0;k<405;k++){
                dp[i][j][k] = dp[i-1][j][k];
                if(j>=a[i-1] && k>=b[i-1]){
                    dp[i][j][k] = min(dp[i][j][k],dp[i-1][j-a[i-1]][k-b[i-1]]+c[i-1]);
                }
            }
        }
    }
    int ans = 1000000000;
    for(int i=1;i<405;i++){
        for(int j=1;j<405;j++){
            if(mb*i == ma*j){
                ans = min(ans,dp[n][i][j]);
            }
        }
    }
    if(ans == 100000000)cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 29056
#include <bits/stdc++.h>
        using namespace std;
        int main()
        {
        	long n;
          	vector<char> dog;
          	cin>>n;
          	while(n!=0)
            {
              	n--;
              	dog.push_back((n%26)+'a');
              	n/=26;
            }
          	for(int i=dog.size()-1;i>=0;i--) cout<<dog[i];
        }

Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <queue>
#include <vector>

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

using namespace std;

class Edge{
public:
    int to;
    int cost;
    Edge(int to,int cost):to(to),cost(cost){}
};

class Node{
public:
    int used;
    int p;
    int cost;
    Node(int u,int n,int c):used(u),p(n),cost(c){}

    bool operator<(const Node &a)const{
        return cost>a.cost;
    }
};

int main(){
    int c,n,m,s,d;
    while(cin>>c>>n>>m>>s>>d,c+n+m+s+d){

        vector<Edge> edge[101];
        rep(i,m){
            int a,b,f;
            cin >> a >> b >> f;
            edge[a].push_back(Edge(b,f));
            edge[b].push_back(Edge(a,f));
        }

        priority_queue<Node> Q;
        Q.push(Node(0,s,0));

        bool used[101][11] = {0};

        while(!Q.empty()){
            Node node = Q.top();Q.pop();
            if(used[node.p][node.used]){
                continue;
            }
            used[node.p][node.used] = true;

            int p = node.p;

            if(p==d){
                cout << node.cost << endl;
                break;
            }

            rep(i,edge[p].size()){
                Edge e = edge[p][i];
                int next = e.to;
                int cost = node.cost + e.cost;
                Q.push(Node(node.used,next,cost));
                if(node.used<c){
                    cost = node.cost + e.cost/2;
                    Q.push(Node(node.used+1,next,cost));
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1308