akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int N, M;
        Input(out N, out M);
        if(N == M) {
            Console.WriteLine("Yes");
        } else {
            Console.WriteLine("No");
        }
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 500001
using namespace std;
ll mi(ll n,ll m){ll pw=n;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
#define bs binary_search
//#define d double
int main(){
	FIO;
	int h,w,n;
	cin>>h>>w>>n;
	if(h>w){
	    if(n%h==0) cout<<n/h;
	    else cout<<(n/h)+1;
	}
	else{
	    if(n%w==0) cout<<n/w;
	    else cout<<(n/w)+1;
	}
} 
 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>

#define MAX 1000005

using namespace std;

vector<int> activities[3];

int dp[MAX][3];

int N;

int vacation(int i, int prev);

int main() {

    scanf("%d", &N);
    for(int i = 0; i < N; ++i)
    {
        int x, y, z;
        scanf("%d %d %d", &x, &y, &z);
        activities[0].push_back(x);
        activities[1].push_back(y);
        activities[2].push_back(z);
    }
    memset(&dp, -1, sizeof dp);
    printf("%d", vacation(0, 0));
    return 0;
}

int vacation(int i, int prev)
{
    if(i >= N) return 0;
    if(dp[i][prev] != -1) return dp[i][prev];
    else{
        int tmp = 0;
        if(prev != 0 || i == 0){
            tmp = max(tmp, vacation(i + 1, 0) + activities[0][i]);
        }
        if(prev != 1){
            tmp = max(tmp, vacation(i + 1, 1) + activities[1][i]);
        }
        if(prev != 2){
            tmp = max(tmp, vacation(i + 1, 2) + activities[2][i]);
        }
        dp[i][prev] = tmp;
        return dp[i][prev];
    }
}

Measured memory_bytes: 18028
/**********************************************
*   UPDATE CONDITION & OVERFLOW CONDITION     *
**********************************************/

#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926535
#define endl "\n"
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define ll long long
#define llu unsigned long long
#define pb push_back
#define mp make_pair
#define tc int t; cin>>t; while(t--)
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n-1 ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const long long int inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    fast;
    ll x;
    cin >> x;
    for(ll i = 1; i < 1000 ; i++)
    {
        for(ll j = -1000 ; j < 1000 ; j++)
        {
            if(i*i*i*i*i - j*j*j*j*j == x)
            {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}



Measured memory_bytes: 3652
private data class Monster(var hp: Int, val attack: Int)

fun main (args:Array<String>) {
    var (takahashi , aoki) = readLine()!!.split(" ").map(String::toInt)
                                .windowed(size = 2, step = 2).flatMap { it.zipWithNext { hp, attack -> Monster(hp, attack) } }

    // println(takahashi)
    // println(aoki)
    var term = 0
    while (takahashi.hp > 0 && aoki.hp > 0) {
        term++
        if (term % 2 == 1) {
            aoki.hp -= takahashi.attack
        } else {
            takahashi.hp -= aoki.attack
        }
    }

    if (aoki.hp <= 0) {
        print("Yes")
        return
    }
    print("No")
}


Measured memory_bytes: 36640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <cmath>
#include <utility>
#define Maxn 100005
#define Maxm 1000005
#define lowbit(x) x&(-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1.0)
#define eps 1e-12
#define LL long long 
#define Inf (1LL<<62)
#define inf 0x3f3f3f3f
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
using namespace std;
const int mod=1e9+7;
int main()
{
	//input;output;
	int arr[Maxn],n,ans;
	while(~scanf("%d",&n))
	{
		ans=0;
		for(int i=1;i<=n;i++)
			scanf("%d",arr+i);
		for(int i=1;i<n;i++)
			if(arr[i]==i&&arr[i+1]==i+1)
			{
				swap(arr[i],arr[i+1]);
				ans++;
			}
		for(int i=1;i<n;i++)
			if(arr[i]==i||arr[i+1]==i+1)
			{
				swap(arr[i],arr[i+1]);
				ans++;
			}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;

const int N=100005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x+=y;if(x>=mod) x-=mod;}

int m,n,k,dp[3005][3005][2];

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) dp[0][i][0]=1;
	dp[0][0][1]=1;
	for(int i=0;i<m;i++){
		for(int j=0;j<=n;j++)
			for(int k=0;k<2;k++){
				if(!dp[i][j][k]) continue;
//				printf("%d %d %d: dp=%d\n",i,j,k,dp[i][j][k]);
				RR:
					if(j==1) ch(dp[i+1][j-1][1],dp[i][j][k]);
					if(j>1) ch(dp[i+1][j-1][k],dp[i][j][k]);
				RB:
					if(j==1) ch(dp[i+1][j][1],dp[i][j][k]);
					if(j>1) ch(dp[i+1][j][k],dp[i][j][k]);
				BR:
//					if(j==n-1) ch(dp[i+1][j][k|1],dp[i][j][k]);
					if(j<=n-1) ch(dp[i+1][j][k],dp[i][j][k]);
				BB:
//					if(j==n-1) ch(dp[i+1][j+1][k|1],dp[i][j][k]);
					if(j<=n-1) ch(dp[i+1][j+1][k],dp[i][j][k]);
			}
	}
	int ans=0;
	for(int j=0;j<=n;j++)
		ch(ans,dp[m][j][1]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 70656
N=int(input())
A=[int(input()) for i in range(N)]
odd =[A[i] for i in range(N) if i%2 ==0]
even=[A[i] for i in range(N) if i%2 ==1]
import collections
table=collections.defaultdict(int)
table2=collections.defaultdict(int)
A.sort()
for i in range(N):
  if i %2==0:
    table[A[i]]+=1
for x in odd:
  table2[x]+=1
ans=0

for x in table:
  ans+=(table[x] -table2[x])

print(ans)

Measured memory_bytes: 20496
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define mk make_pair
#define vec vector<int> 
#define finput ifstream cin;cin.open("in.txt")
#define foutput ofstream cout;cout.open("out.txt") 

int main(){
//	finput;foutput;
	ios_base::sync_with_stdio(false);
    int n,m,x,y;
    cin>>n>>m>>x>>y;
    int a[n],mn=INT_MIN,mx=INT_MAX;
    for(int i=0;i<n;i++){
    	int temp;
    	cin>>temp;
    	mn=max(mn,temp);
    }
    for(int i=0;i<m;i++){
    	int temp;
    	cin>>temp;
    	mx=min(mx,temp);
    }
    //cout<<mn<<" "<<x;
    if(max(mn,x)<min(mx,y)){
    	cout<<"No War";
    	return 0;
    }
    cout<<"War";
}

Measured memory_bytes: 256
#include <iostream> // c++の標準入出力
#include <stdio.h> // c言語の標準入出力
#include <string>
using namespace std;

int main()
{
	int a, b, c, d, e;
	scanf("%d", &a);
	scanf("%d", &b);
	c = a + b;
	d = a - b;
	e = a * b;
		if (c >= d && c >= e) { printf("%d", c); }
		else if (d >= e && d >= c) { printf("%d", d); }
		else if (e >= c && e >= d) { printf("%d", e); }
	
}
	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int b[n]={0};
    b[0]=0;
    b[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        int mi = INT_MAX;
        for(int j=1;j<=k && i-j>=0;j++)
        {
            mi=min(mi,b[i-j]+abs(a[i]-a[i-j]));    
        }
        b[i]=mi;
    }
   cout<<b[n-1];
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
static const int inf = 1 << 30;

int main(void) {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int argmin = -1;
  int minimum = A * X + B * Y;
  int preminimum = inf;
  for (int i = 0; i <= 2 * X; i++) {
    minimum = min(minimum, A * (X - i / 2) + C * i);
    if (preminimum > minimum) {
      argmin = i;
    }
  }
  int aa = A * (X - argmin / 2) + B * max(0, Y - argmin / 2) + C * argmin;
  minimum = inf;
  preminimum = inf;
  for (int i = 0; i <= 2 * Y; i++) {
    minimum = min(minimum, B * (Y - i / 2) + C * i);
    if (preminimum > minimum) {
      argmin = i;
    }
  }
  int bb = B * (Y - argmin / 2) + A * max(0, X - argmin / 2) + C * argmin;
  int mm = min(aa, bb);
  mm = min(mm, A * X + B * Y);
  cout << mm << endl;
}

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

using ll = long long;
constexpr auto PrimeBigNum10_9_7 = 1000000007;

// 素数判定
template <typename T>
bool IsPrimeNumber(T value) {

	for (int i = 2; i * i <= value; ++i) {
		if ((value % i) == 0) {
			return true;
		}
	}
	return false;
}

// 桁数判定
template <typename T>
T GetFigureLength(T value) {
	T figure = 1;
	while (value >= 10) {
		value /= 10;
		++figure;
	}
	return figure;
}

// 素因数分解結果
template <typename T>
map<T, T> GetPrimeFactorize(T value) {

	map<T, T> res;

	for (T i = 2; i * i <= value; ++i) {
		if ((value%i) != 0)	continue;

		T count = 0;
		while ((value % i) == 0) {
			value /= i;
			++count;
		}

		res[i] = count;
	}

	if (value != 1) {
		res[value] = 1;
	}
	return res;
}

void answer(int a, int b) {
	cout << a << " " << b;
}

int main(void) {


	ll x;
	cin >> x;

	/*

	{
		auto v = pow(10,9);

		int valP = 0;
		int valM = 0;
		for (int i = 1; i < 2000; ++i) {
			auto a = pow(i, 5) - pow(i - 1, 5);
			if (a >= v) {
				valP = i;
				break;
			}
		}
		for (int i = 1; i < 2000; ++i) {
			auto a = pow(-i, 5) - pow(-i - 1, 5);
			if (a >= v) {
				valM = -i;
				break;
			}
		}
		cout << valP << " " << valM;
		return 0;
	}
	→120,-119のため、答えは-119<=A|B<=120
	*/

	
	map<ll, int> ans;
	for (int i{ 1000 }; i--;) {
		ll val = 1;
		for (int j{}; j < 5; ++j) val *= i;

		if (ans[val + x]) {
			cout << ans[val + x]<< " " <<  i;
			break;
		}

		if (ans[-val + x]) {
			cout << ans[-val + x]<< " " <<  -i;
			break;
		}

		ans[val] = i;
	}
	/*map<ll, int> mp;
	for (int i{ 1000 }; i--;) {
		ll c{ 1 };
		for (int j{}; j < 5; ++j) c *= i;
		if (mp[c + x])
			return cout << mp[c + x] << " " << i << endl, 0;
		if (mp[x - c])
			return cout << mp[x - c] << " " << -i << endl, 0;
		mp[c] = i;
	}
*/

	//auto output = resultCount;
	//cout << output;

	return 0;
}


Measured memory_bytes: 3752
import math
import collections
import itertools

def resolve():
    #D,T,S=map(int,input().split())
    S=input()
    T=input()

    min=999999
    for i in range(len(S)-len(T)+1):
        tmp=S[i:i+len(T)]
        diff=0
        for j in range(len(T)):
            if(T[j]!=tmp[j]):
                diff+=1
        if(min>diff):
            min=diff
    
    print(min)

resolve()

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a){cout<<((a)?"Yes":"No")<<endl;}
void YESNO(int a){cout<<((a)?"YES":"NO")<<endl;}
void AorB(int a,string b,string c){cout<<((a)?b:c)<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,m,Q,k;;
    cin>>n;
    m=n-1;
    Vi ans(n,0),a(m),b(m),c(m),dist(n);
    vector<vector<Pii>> connect(n);
    REP(i,0,m){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--;
        connect[a[i]].pb(mp(b[i],c[i]));
        connect[b[i]].pb(mp(a[i],c[i]));
    }
    cin>>Q>>k;
    k--;
    Vi x(Q),y(Q);
    REP(i,0,Q){
        cin>>x[i]>>y[i];
        x[i]--; y[i]--;
    }
    
    queue<Tiii> q;
    q.push(mt(k,-1,0));
    while(!q.empty()){
        int now,past,dnow;
        tie(now,past,dnow)=q.front();
        q.pop();
        dist[now]=dnow;
        REP(i,0,connect[now].size()) if(connect[now][i].first!=past) q.push(mt(connect[now][i].first,now,dnow+connect[now][i].second));
    }
    REP(i,0,Q) cout<<dist[x[i]]+dist[y[i]]<<endl;
    return 0;
}


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

#define REP(i,a,b) for(i=a; i<b; ++i)
#define rep(i,n) REP(i,0,n)

struct range{
  int start,end,color;
  range() {;}
  range(int start,int end,int color) : start(start), end(end), color(color) {;}
};

int main() {
  int n,i,j,k;
  ios_base::sync_with_stdio(false);
  while(cin>>n, n) {
    vector<range> stones;
    rep(i,n) {
      cin>>j;
      if(stones.empty()) stones.push_back(range(i+1,i+1,j));
      else if(i%2==0) {
	if(j == stones.back().color) stones.back().end++;
	else stones.push_back(range(i+1,i+1,j));
      }else{
	if(stones.back().color == j) stones.back().end++;
	else {
	  int st = i+1;
	  while(!stones.empty()) {
	    if(stones.back().color == j) {
	      stones.push_back(range(st,i+1,j));
	      break;
	    }else{
	      st = stones.back().start;
	      stones.pop_back();
	    }
	  }
	  if(stones.empty()) stones.push_back(range(1,i+1,j));
	}
      }
    }

    int ans = 0;
    rep(i,stones.size()) {
      if(stones[i].color == 0) {
	//cout<<stones[i].start<<" "<<stones[i].end<<" "<<stones[i].color<<endl;
	ans += stones[i].end - stones[i].start + 1;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 0
N=int(input())
x=[0]*N
y=[0]*N
mon=0
for i in range(N):
  x[i],y[i] = input().split()
  x[i]=float(x[i])
  if y[i]=="JPY":
    mon += x[i]
  else:
    mon += x[i]*380000.0
    
print(mon)

Measured memory_bytes: 3060
function main(input) {
   input = input.trim();
  const a = input.split(" ");
  const day = ["SAT","FRI","THU","WED","TUE","MON","SUN"];
	for(var i = 0; i < day.length; i++) {
		if(a[0]==day[i]) {
			console.log(i+1);
			break;
		}
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30284
n = int(input())
d = {}

while n > 0:
    M, N = map(str,input().split())
    if M in d:
        d[M].append(int(N))
    else:
        d[M] = [int(N)]

    n -= 1

mark = ["S","H","C","D"]

for m in mark:
    L = [i for i in range(1,14) if i not in d[m]]

    for l in L:
        print(m,l)


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

int N, a, d, M;

int F(int x)
{
  return(a + (x - 1) * d);
}
int main()
{
  cin >> N;
  cin >> a >> d;
  cin >> M;

  // ????????°???????????¬??? an = a + (n - 1)d

  map< int, int > foo;
  for(int i = 0; i < M; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    map< int, int >::iterator A;
    int val1, val2;
    if((A = foo.find(y)) == foo.end()) val1 = F(y);
    else val1 = A -> second;
    if((A = foo.find(z)) == foo.end()) val2 = F(z);
    else val2 = A -> second;

    if(x == 0) {
      foo[y] = val2;
      foo[z] = val1;
    } else {
      foo[y] = val2;
    }
  }

  int K;
  cin >> K;
  map< int, int >::iterator A;
  int val1;
  if((A = foo.find(K)) == foo.end()) val1 = F(K);
  else val1 = A -> second;

  cout << val1 << endl;
}

Measured memory_bytes: 1196
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
     string S;
     cin >> S;
     int ans = 0;
     for (int i = 1; i < S.size(); i++) {
         if (S[i] != S[i - 1])ans++;
     }
     cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const ll int INF = 1e18+5;
int main()
{
    ll int n,W,total_sum=0;
    cin >> n >> W;
    vector<ll int> w(n,0),val(n,0);
    for(ll int i=0;i<n;i++)
    {
        cin >> w[i] >> val[i];
    }
    for(int i=0;i<n;i++)
        total_sum += val[i];
    vector<ll int>dp(total_sum+1,INF);
    dp[0]=0;
    for(ll int i=0;i<n;i++){
        
        for(ll int j=total_sum-val[i];j>=0;j--){
            dp[j+val[i]]=min(dp[j+val[i]],dp[j]+w[i]);
        }
    }
             
    ll int ans =0 ;
                      for(ll int i=0;i<=total_sum;i++)
                      {
                          if(dp[i] <= W)
                          {
                              ans = max(ans,i);
                          }
                      }
                      cout << ans;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <stdlib.h>
#include <map>
#include <algorithm>
#define llint long long
#define inf 1e9

using namespace std;

int T;
int h, w;
char c[55][55];
int a[55][55];
map<char, int> mp;

int main(void)
{
  cin >> T;
  for(int t = 0; t < T; t++){
    cin >> h >> w;
    mp.clear();
    for(int y = 1; y <= h; y++){
      for(int x = 1; x <= w; x++){
        cin >> c[x][y];
        if(c[x][y] != '.') mp[c[x][y]];
      }
    }

    int id = 0;
    for(auto it = mp.begin(); it != mp.end(); it++) it->second = id++;

    for(int y = 1; y <= h; y++){
      for(int x = 1; x <= w; x++){
        if(c[x][y] == '.') a[x][y] = -1;
        else a[x][y] = mp[c[x][y]];
      }
    }
    int n = mp.size();

    int perm[7], iperm[7];
    for(int i = 0; i < n; i++) perm[i] = i;
    bool ans = false;
    do{
      for(int i = 0; i < n; i++) iperm[perm[i]] = i;
      bool flag = true;
      for(int i = 0; i < n; i++){
        int lx = inf, rx = -inf, ly = inf, ry = -inf;
        for(int y = 1; y <= h; y++){
          for(int x = 1; x <= w; x++){
            if(a[x][y] == perm[i]){
              lx = min(lx, x);
              rx = max(rx, x);
              ly = min(ly, y);
              ry = max(ry, y);
            }
          }
        }
        for(int y = ly; y <= ry; y++){
          for(int x = lx; x <= rx; x++){
            if(a[x][y] == -1) flag = false;
            else if(iperm[a[x][y]] < i) flag = false;
          }
        }
      }
      if(flag) ans = true;
    }while(next_permutation(perm, perm+n));

    if(ans) cout << "SAFE" << endl;
    else cout << "SUSPICIOUS" << endl;
  }

  return 0;
}



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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int64 dfs(int64 n, int64 k, int64 s) {
	if (k == 0) return s == 0;
	if (s < k || n <= 0) return 0;
	return dfs(n-1, k, s) + dfs(n-1, k-1, s-n);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 n, k, s;
	while (cin >> n >> k >> s && n+k+s) {
		cout << dfs(n, k, s) << endl;
	}
}



Measured memory_bytes: 3196
// https://atcoder.jp/contests/abc074/tasks/arc083_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    int n;
    cin >> n;
    vector<vector<int>> d(n, vector<int>(n));
    vector<vector<bool>> b(n, vector<bool>(n));

    REP(i, n) REP(j, n) cin >> d[i][j];
    REP(k, n) REP(i, n) REP(j, n) {
        if (k == i || k == j)
            continue;
        // 3辺の一番長い辺が、それ以外の辺の合計より大きければ不成立
        if (d[i][j] > d[i][k] + d[k][j]) {
            cout << "-1\n";
            return 0;
        }
        // 等しければ辺を作らない
        if (d[i][j] == d[i][k] + d[k][j]) {
            b[i][j] = true;
        }
    }
    ll ans = 0;
    REP(i, n) FOR(j, i + 1, n) {
        if (!b[i][j]) {
            ans += d[i][j];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int r;
	cin >> r;
	cout << r*r << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define len(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define chmax(x, v) x = max((x), (v))
#define chmin(x, v) x = min((x), (v))
using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int nbRow, nbCol, target;
	cin >> nbRow >> nbCol >> target;
	vector<vector<char>> grid(nbRow, vector<char>(nbCol));
	for (int row = 0; row < nbRow; ++row) {
		for (int col = 0; col < nbCol; ++col) {
			cin >> grid[row][col];
		}
	}
	int res = 0;
	for (int maskRow = 0; maskRow < (1<<nbRow); ++maskRow) {
		for (int maskCol = 0; maskCol < (1<<nbCol); ++maskCol) {
			int cnt = 0;
			for (int row = 0; row < nbRow; ++row) {
				for (int col = 0; col < nbCol; ++col) {
					if (grid[row][col] == '#' && !((1<<row)&maskRow) && !((1<<col)&maskCol)) {
						++cnt;
					}
				}
			}
			if (cnt == target) ++res;
		}
	}
	cout << res << "\n";
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define lowbit(x) (x & (-x))
const int maxn = 1e5 + 10;
int a[maxn], b[maxn];
int C[maxn * 2];
int n;
void add(int x, int val)
{
	for(int i = x; i < maxn * 2; i += lowbit(i))
		C[i] += val;
}
int query(int x)
{
	int ret = 0;
	for(int i = x; i; i -= lowbit(i))
		ret += C[i];
	return ret;
}
bool check(int x)
{
	memset(C, 0, sizeof C);
	const ll K = 1ll * n * (n + 1) / 4 + 1;
	ll cnt = 0;
	int sum = 0;
	add(sum + maxn, 1);
	for(int i = 1; i <= n; ++i)
	{
		if(a[i] <= x)
			--sum;
		else
			++sum;
		cnt += query(sum + maxn);
		add(sum + maxn, 1);
	}
	cnt = 1ll * n * (n + 1) / 2 - cnt;
	if(cnt >= K)
		return 1;
	else
		return 0;
}		
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d", &a[i]);
		b[i] = a[i];
	}
	sort(b + 1, b + n + 1);
	int l = 1, r = n;
	while(l <= r)
	{
		int mid = l + r >> 1;
		if(check(b[mid]))
			r = mid - 1;
		else
			l = mid + 1;
	}
	printf("%d\n", b[l]);
	return 0;
}
	 

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

int main() {
    int H, W, N; cin >> H >> W >> N;
    map<pair<int, int>, long long> m;
    while (N--) {
        int a, b; cin >> a >> b;
        for (int i = max(2, a - 1); i <= min(H - 1, a + 1); i++) {
            for (int j = max(2, b - 1); j <= min(W - 1, b + 1); j++) {
                m[{i, j}]++;
            }
        }
    }
    vector<long long> cnt(10, 0);
    for (auto p: m) cnt[p.second]++;
    cnt[0] = 1LL * (H - 2) * (W - 2);
    for (int i = 1; i <= 9; i++) cnt[0] -= cnt[i];
    for (int i = 0; i < 10; i++) cout << cnt[i] << endl;
    return 0;
}

Measured memory_bytes: 56448
/**
*    author:  y_takano
*    created: 23.06.2020 10:10:24
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

using namespace std;

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

    int n;
    double p1, p2, p3, pm, x[100], y[100];

    cin >> n;

    REP(i, n)
    {
        cin>>x[i];
    }
    REP(i, n)
    {
        cin>>y[i];
    }

    p1 = p2 = p3 = pm = 0.0;

    REP(i, n)
    {
        p1+=abs(x[i]-y[i]);
        p2+=pow(abs(x[i]-y[i]),2);
        p3+=pow(abs(x[i]-y[i]),3);
        pm=max(pm,abs(x[i]-y[i]));
    }

    printf("%.8lf\n",p1);
    printf("%.8lf\n",sqrt(p2));
    printf("%.8lf\n",cbrt(p3));
    printf("%.8lf\n",pm);

    return 0;
}


Measured memory_bytes: 3432
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, F[200], P[200][20];

ll solve(ll st){
    ll ret = 0;
    REP(i, N){
        ll c = bitset<10>(st & F[i]).count();
        ret += P[i][c];
    }
    return ret;
}

signed main(){
    cin >> N;
    ll f;
    REP(i, N){
        REP(j, 10){
            cin >> f;
            F[i] += f * (1 << j);
        }
    }
    REP(i, N) REP(j, 11) cin >> P[i][j];
    ll ans = LONG_LONG_MIN;
    FOR(i, 1, 1 << 10){
        ans = max(ans, solve(i));
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main() {
	int n;
	while (1) {
		cin >> n;
		if (n == 0) break;

		int col[1000];
		int s;
		for (int i = 0; i < n; i++) {
			cin >> s;
			col[i] = s;
		}
		
		double m = 0;
		for (int i = 0; i < n; i++) {
			m += col[i];
		}

		double na2 = 0;
		for (int i = 0; i < n; i++) {
			na2 += pow(col[i] - m/n, 2);
		}

		printf("%lf\n", sqrt(na2 / n));
	}
	return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

typedef long long ll;
#define MAX 200005
#define MOD 2019

int main(int, char**)
{

    string s;
    cin >> s;

    reverse(s.begin(), s.end());

    int n = s.size();

    int md = 0;
    int b = 1;
    ll count[MOD] = {1, 0};
    for (int i = 0; i < n; i++) {
        md = (md + (s[i]-'0') * b) % MOD;
        count[md]++;
        b = b * 10 % MOD;
    }

    ll sum = 0;
    for (int i = 0; i < MOD; i++)
        if (count[i] >= 2) {
            sum += count[i] * (count[i]-1) / 2;
        }

    cout << sum << endl;

    return 0;
}

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

#define ll long long
#define ld double
#define pii pair<ll,ll>
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vp vector<pii>
#define pb push_back
#define mp make_pair
#define sc(a) scanf("%lld",&a);
#define sd(a) scanf("%lf",&a);
#define test() ll tt;cin>>tt;for(ll testcase=1;testcase<=tt;testcase++)
#define all(v) v.begin(),v.end()
#define vivek_ghosh ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000055
#define mod 1000000007
#define ff first
#define ss second
const long long int INF=0x3f3f3f3f3f3f;

ll power(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

ll modinv(ll a,ll m)
{
    ll g =__gcd(a, m);
    ll res=power(a, m-2, m);
    return res;
}

vb prime(MAX,true);
vl prm;
void sieve()
{
	prime[0] = prime[1] = false;
	for(ll p=2;p*p<MAX;p++)
	{
		if(prime[p])
		{
			for(ll i=p*p;i<MAX;i+=p)
				prime[i] = false;
		}
	}
	for(ll p=2;p<MAX;p++)
	{
		if(prime[p])
			prm.pb(p);
	}
}

ll n,m,t,i,j,k,q,x,y,ans=0,cnt=0,sum=0,mx=-1,mn=INT_MAX;
string s;

int main()
{
    vivek_ghosh;

    cin>>n;
    
    vl a(n+1,0);
    
    for(i=1;i<=n;i++)
        cin>>a[i];
        
    ll id = (n/2);
    
    while(id>0)
    {
        for(ll i=id+id;i<=n;i+=id)
            a[id] ^= a[i];

        if(a[id])
            ans++;

        id--;
    }
    
    for(ll i=1+(n/2);i<=n;i++)
    {
        if(a[i])    
            ans++;
    }
    
    cout<<ans<<endl;
    for(i=1;i<=n;i++)
        if(a[i])
            cout<<i<<" ";
    
    
    
    return 0;
}







Measured memory_bytes: 2688
n,m,R = map(int,input().split())
r = list(map(int,input().split()))
INF = 10**10
d = [[INF for i in range(n)] for j in range(n)]

for i in range(m):
    a,b,c = map(int,input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k]+d[k][j])

from itertools import permutations

ans = INF
for v in permutations(r,R):
    dis = 0
    for i in range(R-1):
        dis += d[v[i]-1][v[i+1]-1]
    ans = min(ans,dis)

print(ans)


Measured memory_bytes: 46936
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;
	int N = S.size();
	REP(i, N - 1) {
		if (S[i] == S[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
	}
	REP(i, N - 2) {
		if (S[i] == S[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}

	cout << -1 << " " << -1 << endl;
	return 0;
}



Measured memory_bytes: 512
a, b, c, x, y = map(int, input().split())

ans = 0
if x >= y:
    if (a+b) >= 2*c:
        ans = min(2*c*y + a*(x-y), 2*c*x)
    else:
        ans = a*x+b*y

else:
    if (a+b) >= 2*c:
        ans = min(2*c*x + b*(y-x), 2*c*y)
    else:
        ans = a*x+b*y

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#include <set>
#include <map>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int x,t;

int main()
{
    cin >> x >> t;
    if(x > t){
        cout<<x-t<<endl;
    }else{
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    char c1, c2, c3, c4, c5, c6;
    cin >> c1 >> c2 >> c3;
    cin >> c4 >> c5 >> c6;

    if(c1==c6&&c2==c5&&c3==c4){
        cout << "YES" << "\n";
    }else{
        cout << "NO" << "\n";
    }
}


Measured memory_bytes: 256
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 07/14/20 20:57:13
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);

  int a,b; cin>>a>>b;
  if (b%a==0) {
    cout << a+b << endl;
  } else {
    cout << b-a << endl;
  }

  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------


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

  vector<bool> to_k;
  vector<bool> to_g;
  to_k.assign(n, false);
  to_g.assign(n, false);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    if(a==1 || b==1) to_k[max(a, b)-1] = true;
    if(a==n || b==n) to_g[min(a, b)-1] = true;
  }

  // 島1 -> 島k -> 島n
  bool enable = false;
  rep1(k, n-1) {
    if(to_k[k] && to_g[k]) enable = true;
  }

  if(enable) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const int INF=1e9;
const ll MOD=1e9+7;

int N;
int a,b,c,d,e,f,g,h,cnt;

int main(){

cin>>N; 

for(int i=0; i<N; i++){
    int x;
    scanf("%d",&x);
    if(1<=x&&x<400) a=1;
    if(400<=x&&x<800) b=1;
    if(800<=x&&x<1200) c=1;
    if(1200<=x&&x<1600) d=1;
    if(1600<=x&&x<2000) e=1;
    if(2000<=x&&x<2400) f=1;
    if(2400<=x&&x<2800) g=1;
    if(2800<=x&&x<3200) h=1;
    if(x>=3200) cnt++;
}

int Min=a+b+c+d+e+f+g+h;
if(Min==0){
    cout<<1<<" "<<cnt<<endl; return 0;
}else{
    int Max=Min+cnt;
    cout<<Min<<" "<<Max<<endl;
}

}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Contest.A
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			Scanner cin = new Scanner();

			int n = cin.NextInt();
			int p = cin.NextInt();
			var a = cin.ArrayInt(n);

			// 余りがpと等しくなる数
			var dp = new long[n];
			if (p == 0)
			{
				if (a[0] % 2 == 0) dp[0] = 2;
				else dp[0] = 1;
			}
			else
			{
				if (a[0] % 2 == 1) dp[0] = 1;
				else dp[0] = 0;
			}

			for (int i = 1; i < n; i++)
			{
				if (a[i] % 2 == 0) dp[i] = dp[i - 1] * 2;
				else dp[i] = dp[i - 1] + (1L << i) - dp[i - 1];
			}
			Console.WriteLine(dp[n - 1]);

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	if(n==25)
		printf("Christmas");
	else if(n==24)
		printf("Christmas Eve");
	else if(n==23)
		printf("Christmas Eve Eve");
	else if(n==22)
		printf("Christmas Eve Eve Eve");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 3010;
const int MOD = 1000000007;
int f[N][N][2];
int n, m, ans;
void ADD(int &a, int b) {a = a + b; if (a >= MOD) a -= MOD;}
int main()
{
    cin >> n >> m;
    for (int i = 0; i <= n; ++ i) f[0][i][0] = 1;
    for (int i = 0; i < m; ++ i)
        for (int j = 0; j <= n; ++ j)
            for (int k = 0; k < 2; ++ k)
            {
                if (j > 0)
                {
                    ADD(f[i + 1][j - 1][k || (j == 1)], f[i][j][k]);
                    ADD(f[i + 1][j][k || (j == 1)], f[i][j][k]);
                }
                if (j < n)
                {
                    ADD(f[i + 1][j + 1][k || (j == 0)], f[i][j][k]);
                    ADD(f[i + 1][j][k || (j == 0)], f[i][j][k]);
                }
            }
    for (int i = 0; i <= n; ++ i) ADD(ans, f[m][i][1]);
    cout << ans;
}


Measured memory_bytes: 70784
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
#include <chrono>
#include<unordered_map>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

int main()
{
	FORQ(i, 1, 5)
	{
		int a;
		scanf("%d", &a);
		if (!a)
		{
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}

// FOR GNU C++ use the following pattern:
// Uncomment the code below and change your main into main2
// It does not build in MS C++
// But it does increase the stack size from 256 MB on CF and uses GNU C++

//#include <Processthreadsapi.h>
//#include <iostream>
//#include <Synchapi.h>
//#include <windows.h>
//#include <process.h>
//
//DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
//    main2(nullptr);
//    return 0;
//}
//int main() {
//    auto h = CreateThread(nullptr, 1024 << 20, MyThreadFunction, nullptr, STACK_SIZE_PARAM_IS_A_RESERVATION, nullptr);
//    WaitForSingleObject(h, INFINITE);
//}

Measured memory_bytes: 3088
N, W = gets.chomp.split.map(&:to_i)

weights = []
values  = []

N.times do
  weight, value = gets.chomp.split.map(&:to_i)

  weights << weight
  values  << value
end

dp = Array.new(W + 1, 0)

1.upto(N) do |i|
  cw = weights[i - 1]
  cv = values[i - 1]

  W.downto(1) do |w|
    next if w - cw < 0

    nv = dp[w - cw] + cv

    next if nv <= dp[w]

    dp[w] = nv
  end
end

print dp[W]


Measured memory_bytes: 2556
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($N,$K) = explode(" ",trim(fgets(STDIN)));
$P = array_map('intval',explode(" ",trim(fgets(STDIN))));
//function chmax(&$a,$b) {if ($a<$b){$a=$b;return true;}return false;}
//function chmix(&$a,$b) {if ($a>$b){$a=$b;return true;}return false;}

$res=0;

foreach($P as $i=>$v) {
  $k[] = ($v+1)/2;
}
$kd[0]=0;
for($i=0;$i<$N;$i++) {
  $kd[$i+1]=$kd[$i]+$k[$i];
}
$res=0;
/*
for($i=0;$i<$N-$K;$i++) {
  $res = max($res,$kd[$i+$K+1]-$kd[$i+1]);
}
 */
for($i=$K;$i<=$N;$i++) {
  $res = max($res,$kd[$i]-$kd[$i-$K]);
}
printf("%f\n",$res);



Measured memory_bytes: 37356
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

void solve51() {
    vector<int> v;
    REP(i,8) {
        char c;
        cin >> c;
        v.push_back(c - '0');
    }
    sort(ALL(v));
    vector<int> w(v);
    reverse(ALL(w));
    int s = 0;
    int od = 10000000;
    REP(i,8) {
        s += (w[i] - v[i]) * od;
        od /= 10;
    }
    cout << s << endl;
}

int main() {
    int n;
    cin >> n;
    REP(i,n) {
        solve51();
    }
    return 0;
}

Measured memory_bytes: 1216
while True:
    a, op, b = input().split()

    a = int(a)
    b = int(b)

    if op == "?":
        break

    elif op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)



Measured memory_bytes: 5592
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> P;
#define mp(x, y) make_pair(x, y)

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える


int main(void) {
	int n; cin >> n;
	int r = n % 1000;
	int tmp = 1000 - r;
	if (tmp == 1000) cout << 0 << endl;
	else cout << tmp << endl;
	return 0;
}



Measured memory_bytes: 3628