akhauriyash/Code-Regression huggingface dataset:
// inputに入力データ全体が入る
function Main(input) {
	ans = 'Yes'
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.trim().split("\n");
	i = input[0].split(' ').map(n => parseInt(n))
	var an = i[0]
	var so = i[1]
	if (an * 2 > so || an * 4 < so || so % 2 == 1) {
		ans = 'No'
	}




	//出力
	console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require('fs').readFileSync('./input.txt', 'utf-8'));

Measured memory_bytes: 29592
def dist(w, x, y, z):
    return abs(w-y)+abs(x-z)

n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(m)]


for i in range(n):
    tmp = 10**9
    a, b = s[i][0], s[i][1]
    for j in range(m):
        c, d = p[j][0], p[j][1]
        if dist(a, b, c, d) < tmp:
            ans = j+1
            tmp = dist(a, b, c, d)
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
        string s[3];

        for (int i = 0; i < 3; i++)
                cin >> s[i];

        for (int i = 0; i < 3; i++)
                cout << s[i][0];
        cout << endl;
        return 0;
}

Measured memory_bytes: 256
n = gets.to_i
i = 1

loop do
  x = i
  if (x % 3 == 0) then
    printf " %d", i
  else
    loop do
      if (x % 10 == 3 ) then
        printf " %d", i
        break
      end
      x /= 10
      break if x == 0
    end
  end
  i += 1
  break if (i > n)
end

printf "\n"



Measured memory_bytes: 6884
/*
    Auther: ghoshashis545 Ashis Ghosh
    College: Jalpaiguri Govt Enggineering College
*/
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
using namespace std;
#define ll int
#define int long long
#define ld long double
#define ff first
#define ss string 
#define se second
#define endl "\n"
#define alt(v) v.begin(),v.end()
#define ralt(v) v.rbegin(),v.rend()
#define pb emplace_back
#define mp make_pair
#define fab(i,a,b) for(int i=(a);i<(b);i++)
#define fba(i,a,b) for(int i=(b);i>=(a);i--)
int mod=1000000007;
// int mod=998244353;
int dx[]={-1,1,0,0};
int dy[]={0,0,1,-1};

bool test  = 0;
const int N = 1e3+5;
const int inf = 1e18;
int n,m,x1,x2,d1,d2;
void solve()
{
	
    cin>>n>>m;
    cin >>x1>>x2;
    cin >>d1 >>d2;

    x1--,x2--,d1--,d2--;

	vector<string>maze(n);
    for(int i = 0; i<n;++i)
        cin >>maze[i];

    int vis[n][m];
    for(int i=0;i<n;++i)
        for(int j =0;j<m;++j)
            vis[i][j]=inf;

    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>q;
    q.push({x1,x2});
    vis[x1][x2] = 0;

    while(!q.empty())
    {
        int x = q.top().ff;
        int y = q.top().se;
        q.pop();
        for(int i = -2;i <= 2;++i)
            for(int j = -2;j<=2;++j)
            {
                int p1 = x+i;
                int p2 = y+j;
                if(p1<0 or p2<0 or p1>=n or p2>=m or maze[p1][p2]=='#')
                    continue;
                int f = (abs(i)+abs(j)>1);
                if(vis[p1][p2] > vis[x][y]+f)
                {
                    vis[p1][p2] = vis[x][y]+f;
                    q.push({p1,p2});
                }
            }
    }

    if(vis[d1][d2] == inf)
        vis[d1][d2] = -1;

    cout<<vis[d1][d2];

}




    

















signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    if(test)
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 12580
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#define LLMAX 9223372036854775807

using namespace std;
using ll = long long;

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

	while (argS.size() >= 0) {
		if (argS.size() == 0) {
			cout << "YES" << endl;
			return 0;
		}
		if (argS.size() >= 7) {
		    string substrS = argS.substr(argS.size() - 7, 7);
		    if (substrS == "dreamer") {
				argS = argS.substr(0, argS.size() - 7);
				continue;
			}
		}
		if (argS.size() >= 6) {
			string substrS = argS.substr(argS.size() - 6, 6);
			if (substrS == "eraser") {
				argS = argS.substr(0, argS.size() - 6);
				continue;
			}
		}
		if (argS.size() >= 5) {
			string substrS = argS.substr(argS.size() - 5, 5);
			if (substrS == "erase") {
				argS = argS.substr(0, argS.size() - 5);
				continue;
			}
			else if (substrS == "dream") {
				argS = argS.substr(0, argS.size() - 5);
				continue;
			}
		}
		cout << "NO" << endl;
		return 0;
	}
}

Measured memory_bytes: 760
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int n;
    while (cin>>n, n) {
        int cnt = 0;
        while(n != 1) {
            if (n % 2 == 0) {
                n /= 2;
                cnt++;
            }
            else {
                n = n * 3 + 1;
                cnt++;
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    string s; cin >> s;
    int n = s.size();
    map<char,int> mp;
    rep(i,n){   
        mp[s[i]]++;
    }
    ll res = L_INF;
    for(char ch = 'a';ch<='z';ch++){
        if(mp[ch] == 0)continue;
        ll tmp = 0;
        ll ans = 0;
        rep(j,n){
            if(s[j] == ch) tmp = 0;
            else tmp++;
            ans = max(tmp,ans);
        }
        res = min(ans,res);
    }
    out(res);
}


Measured memory_bytes: 256
S = input()


S_mae = S[:len(S)//2]
S_ushiro = S[len(S)//2:]

S_mae_list = list(S_mae)
S_ushiro_list = list(reversed(S_ushiro))

j = 0
for i in range(len(S)//2):
    if S_mae_list[i] != S_ushiro_list[i]:
        j += 1

print(j)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
????????????????????????????????? ??§?????§  
??????????????? ??§?????§ ???????´<_??? ?????? Welcome to My Coding Space!
???????????? ??? ?´_???`??????/??? ???i     
?????????????????????????????? ???  |???|     
????????? /?????? /??£??£??£??£/??????|  
??? ???_(__??????/???    ???/ .| .|????????????  
??? ????????????/????????????/??????u??????  
---------------------------------------------------------------------------------------------------*/
 


typedef long long ll;
int L, K;
ll dp[201][2];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> L >> K;

    dp[0][1] = 1;
    rep(i, 0, L) {
        dp[i + 1][0] += dp[i][1];
        dp[i + K][0] += dp[i][1];
        dp[i + 1][1] += dp[i][0];
    }

    ll ans = 0;
    rep(i, 1, L + 1) ans += dp[i][0];
    cout << ans << endl;
}

Measured memory_bytes: 3212
N, K, C = map(int, input().split())
S = input()
S_reverse = S[::-1]

l = []
r = []

i = 0
while i<N and len(l)<K:
    if S[i] == 'o':
        l.append(i+1)
        i += C+1
    else:
        i += 1

i = 0
while i<N and len(r)<K:
    if S_reverse[i] == 'o':
        r.append(i)
        i += C+1
    else:
        i += 1

r = [N - i for i in r]
r.reverse()

ans = []

# print(l)
# print(r)

for i in range(K):
    if l[i] == r[i]:
        ans.append(l[i])


# exit()
# ans = set(l) & set(r)

# ans = list(ans)
ans.sort()

for i in ans:
    print(i)

Measured memory_bytes: 27392
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	double y;
	string s;
	cin >> N;

	double a = 0.0;
	rep(i, 0, N)
	{
		cin >> y >> s;
		if (s == "JPY")
		{
			a += y;
		}
		else
		{
			a += y * 380000.0;
		}
	}

	cout << a << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e;
pair <long long, long long> p[200009];
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a;
    for(b=1; b<=a; b++) cin>>p[b].second>>p[b].first;
    sort(p+1,p+a+1);
    for(b=1; b<=a; b++){
        d+=p[b].second;
        if(d>p[b].first) break;
    }
    if(b==a+1){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


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

int main() {
    double a, b, c, d;
    cin >> a >> b >> c >> d;

    printf("%.7f\n", sqrt(pow((c - a), 2) + pow((d - b), 2)));

    return 0;
}


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


int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	int ans = 0;
	for (int i = 0; i < N - 2; ++i) {
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>

int main(void) {
	std::vector< std::vector<int> > c;
	c = std::vector< std::vector<int> >(3, std::vector<int>(3, 0));
	//c.resize(3);
	bool isLying = false;
	for(int i = 0; i < 3; ++i) {
		//c[i].resize(3);
		std::cin >> c[i][0] >> c[i][1] >> c[i][2];
	}
	// calc
	for(int k = 0; k < 3; ++k) {
		c[k][1] -= c[k][0];
		c[k][2] -= c[k][0];
	}
	for(int j = 1; j < 3; ++j) {
		if((c[0][j] != c[1][j]) || (c[1][j] != c[2][j]) || (c[2][j] != c[0][j]))
		isLying = true;
	}
	std::cout << (isLying ? "No" : "Yes") << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define MOD 10000000070
#define DEBUG 0
#define REP(i,n) for(int i=0;i<n;i++)


 int main(){

 	lli a,b;

 	cin>>a>>b;

 	lli ans=0;
 	if(a>=b){
 		ans += a;
 		a--;
 	}
 	else{
 		ans += b;
 		b--;
 	}

 	ans += max(a,b);
 	cout<<ans<<endl;
 
	return 0;
 
}

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

using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const int MOD = 1e9+7;

ll dp[(int)1e5+5][13];

int main() {
  char S[(int)1e5];
  if (scanf("%s", S));
  int N = strlen(S);

  REP(i, N) REP(j, 13) {
    dp[i][j] = 0;
  }
  dp[0][0] = 1;
  REP(i, N) REP(n, 10) REP(r, 13) {
    if (S[i] != '?' && S[i] - '0' != n)
      continue;
    dp[i+1][(r*10+n)%13] = (dp[i+1][(r*10+n)%13] + dp[i][r]) % MOD;
  }
  printf("%d\n", (int)dp[N][5] % MOD);

  return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i];
    ll sum = 0;
    rep(i,n){
        cin >> b[i];
        if(a[i] < b[i]){
            sum += (b[i] - a[i]) / 2;
        }
        else{
            sum -= a[i] - b[i];
        }
    }
    if(sum >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3776
n,m = gets.split(" ").map(&:to_i)
ac = Hash.new(0)
wa = Hash.new(0)

count = 0
while i = gets
    id,result = i.split(" ").map(&:to_s)
    id = id.to_i
    if result == "WA"
        wa[id] += 1
    elsif result == "AC"
        ac[id] += 1
        count = count + wa[id] if ac[id] == 1
    end
end

a = ac.length
a = 0 if a.nil?

puts "#{a} #{count}"



Measured memory_bytes: 8316
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;


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

	long long ans = 0;

	for (long long i = K; i <= N + 1; i++) {
		ans = ans + N * i - i * i + i + 1;
		ans = ans % 1000000007;
	}

	cout << ans;
}

Measured memory_bytes: 3636
import heapq

N = int(input())
A = list(map(int, input().split()))
 
L = A[:N]
heapq.heapify(L) 

sum_L = [0] * (N+1)
sum_L[0] = sum(L)

for i in range(N):
    min_L = heapq.heappushpop(L, A[N+i])
    sum_L[i+1] = sum_L[i] + A[N+i] - min_L
    #print(L, i, A[N+i], min_L, sum_L)

R = A[N*2:]
rev_R = list(map(lambda x: -x, R))
heapq.heapify(rev_R) 

sum_R = [0] * (N+1)
sum_R[N] = sum(R)

for i in range(N-1, -1, -1):
    max_R = -heapq.heappushpop(rev_R, -A[N+i])
    sum_R[i] = sum_R[i+1] + A[N+i] - max_R
    #print(rev_R, i, A[N+i], max_R, sum_R)

ans = -10**14

for i in range(N+1):
    ans = max(ans, sum_L[i] - sum_R[i])

print(ans)

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

int main() {
  vector<int> A(9);
  rep(i, 9) cin >> A[i];
  int n;
  cin >> n;
  rep(i, n) {
    int b;
    cin >> b;
    rep(j, 9) if (A[j] == b) A[j] = 0;
  }
  rep(i, 3) {
    if (A[3*i] == 0 && A[3*i+1] == 0 && A[3*i+2] == 0) {
      cout << "Yes" << endl;
      return 0;
    }
    if (A[i] == 0 && A[i+3] == 0 && A[i+6] == 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (A[0] == 0 && A[4] == 0 && A[8] == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  if (A[2] == 0 && A[4] == 0 && A[6] == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

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

const int INF = 1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	ll n = s.size();
	vector<set<int>> st(26);
	rep(i,n){
		st[(s[i]-'a')].insert(i+1);
	}
	rep(i,26) st[i].insert(INF);
	int m = t.size();
	ll ans = 0, cur = 0;
	rep(i,m){
		int c = t[i] - 'a';
		auto itr = st[c].lower_bound(cur+1);
		if(*itr == INF){
			ans += n - cur;
			cur = 0;
			itr = st[c].lower_bound(cur);
		}
		if(*itr == INF){
			cout << -1 << endl;
			return 0;
		}
		ans += *itr - cur;
		cur = *itr;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8576
#include "bits/stdc++.h"
using namespace std;
int n,a[100005];
int sv[100005];
int main(){

  cin >> n;
  int cnt = 0;
  for(int i = 0;i<n;i++){
    int x;
    cin>>x;
    if(x>n){
      cnt++;
      continue;
    }
    if(sv[x]==x)cnt++;
    else
      sv[x]++;
  }
  for(int i = 1; i <= n; i++)if(sv[i]!=i)cnt+=sv[i];

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


  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
#define rint register int
#define rep(i,l,r) for(rint i=l;i<=r;i++)
#define per(i,l,r) for(rint i=l;i>=r;i--)
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fir first
#define sec second
#define mset(s,t) memset(s,t,sizeof(s))
template<typename T1,typename T2>void ckmin(T1 &a,T2 b){if(a>b)a=b;}
template<typename T1,typename T2>void ckmax(T1 &a,T2 b){if(a<b)a=b;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
int read(){
  int x=0,f=0;
  char ch=getchar();
  while(!isdigit(ch))f|=ch=='-',ch=getchar();
  while(isdigit(ch))x=10*x+ch-'0',ch=getchar();
  return f?-x:x;
}
#define int long long
const int N=500005;
const int mod=998244353;
int l[N],r[N];
int dp[N],n,k;
int sum[N];
signed main(){
  n=read(),k=read();
  for(int i=1;i<=k;i++){
    l[i]=read(),r[i]=read();
    if(l[i]>r[i])swap(l[i],r[i]);
  }
  dp[1]=1,sum[1]=1;
  for(int i=2;i<=n;i++){
    for(int j=1;j<=k;j++){
      int L=i-r[j],R=i-l[j];
      if(R<=0)continue;
      if(L<=0){
        dp[i]=(dp[i]+sum[R])%mod;
      }else{
        dp[i]=(dp[i]+sum[R]-sum[L-1])%mod;
      }
    }
    //printf("dp[%d]=%d\n",i,dp[i]);
    sum[i]=(sum[i-1]+dp[i])%mod;
  }
  printf("%lld\n",(dp[n]%mod+mod)%mod);
  return 0;
}

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

int main() {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;

  if (a1 + a2 + a3 >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
}

Measured memory_bytes: 256
import math

a, b, x = map(int, input().split())
v = a**2 * b
s = (v - x) / a
if x > v / 2:
    t = s * 2 / (a**2)
    print(math.degrees(math.atan(t)))
else:
    ad = x*2 / (a*b)
    print(math.degrees(math.atan(b/ad)))

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

int main() {

  int N,K,result=0;
  cin >> N >> K;
  result = 1;
  for(int i=0;i < N;i++){
    if(result*2 < result+K)
      result *= 2;
    else
      result += K;
  }
  cout << result << endl;
  
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  string s;
  cin >> s;
  loop(i, 1, s.size()) {
    if (s[i - 1] == s[i]) {
      cout << i << ' ' << i + 1 << endl;
      return;
    }
  }
  loop(i, 2, s.size()) {
    if (s[i - 2] == s[i]) {
      cout << i - 1 << ' ' << i + 1 << endl;
      return;
    }
  }
  cout << "-1 -1" << endl;
}


Measured memory_bytes: 512
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define pii pair<int,int>
#define x first
#define y second

const int N=405;
int n,a[N];
char s[N];
vector<pii> ans;

string rev(string s){
	reverse(s.begin(),s.end());
	for(char &c:s){
		if(c>='a') c-='a'-'A';
		else c+='a'-'A';
	}
	return s;
}

signed main(){
	read(n);
	for(int i=0;i<(1<<n);i++) scanf("%1d",&a[i]);
	if(!a[0]) return puts("Impossible"),0;
	for(int i=0;i<(1<<n);i++) if(a[i])
		for(int j=(i-1)&i;j;j=(j-1)&i) if(!a[j])
			return puts("Impossible"),0;
	ans.emplace_back(0,0);
	for(int i=0;i<(1<<n);i++) if(!a[i]){
		bool flag=0;
		for(int j=(i-1)&i;j;j=(j-1)&i) if(!a[j]){
			flag=1;
			break;
		}
		if(flag) continue;
		string s;
		for(int j=0;j<n;j++) if(i>>j&1){
			if(s.empty()) s=(char)('a'+j);
			else s=(char)('a'+j)+s+(char)('A'+j)+rev(s);
		}
		int pos=0;
		for(char c:s){
			int x=0,d=0;
			if(c>='a') x=c-'a',d=1;
			else x=c-'A',d=0;
			while(pos<x) ans.emplace_back(++pos,0);
			while(pos>x) ans.emplace_back(--pos,0);
			if(d){
				ans.emplace_back(x,1);
				ans.emplace_back(x+1,1);
				ans.emplace_back(x+1,0);
				ans.emplace_back(x,0);
			}
			else{
				ans.emplace_back(x+1,0);
				ans.emplace_back(x+1,1);
				ans.emplace_back(x,1);
				ans.emplace_back(x,0);
			}
		}
		while(pos) ans.emplace_back(--pos,0);
	}
	puts("Possible");
	write(ans.size()-1);puts("");
	for(auto x:ans) write(x.x),putchar(' '),write(x.y),puts("");
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = double;
using pll = pair < ll, ll >;
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
#define pb push_back
#define mp make_pair
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
 
int main(){
    ll s, w; cin >> s >> w;
    if(w >= s) {
        cout << "unsafe\n";
    } else {
        cout << "safe\n";
    }
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,a[13]={0,1,3,1,2,1,2,1,1,2,1,2,1}
 ; cin >> x >> y;
  if(a[x]==a[y])cout<<"Yes";
  else cout << "No";
}


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

 using namespace std;
 int main() {
   int H, W, i, j;
   string S;
   bool finished = false;

   cin >> H >> W;
   for (i = 1; i <= H; i++) {
     for (j = 1; j <= W; j++) {
       cin >> S;
       if (S == "snuke") {
         cout << (char)(64 + j) << i << endl;
         finished = true;
         break;
       }
     }
     if (finished) break;
   }
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  string s;
  char c;
  cin>>s;
  rep(i,3){
    cin>>c;
    if(c==s[s.size()-1-i]) continue;
    else{cout<<"NO"<<endl;return 0;}
  }
  cout<<"YES"<<endl;
  return 0;
}



Measured memory_bytes: 256
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

AT = {'A', 'C', 'G', 'T'}
S = list(read().decode('utf8').rstrip())

lis = [0] * len(S)
for s in range(len(S)):
    if S[s] in AT:
        if lis[s - 1] != 0:
            lis[s] += lis[s - 1] + 1
        else:
            lis[s] = 1
    else:
        lis[s] = 0

print(max(lis))


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

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

  long long int A[N], sum[N+1];
  for(long long int i = 0; i < N; ++i) cin >> A[i];

  sum[0] = 0;
  for(long long int i = 1; i <= N; ++i) sum[i] = (sum[i-1]+A[i-1])%M;

  unordered_map<long long int, long long int> m;
  for(long long int i = 0; i <= N; ++i) ++m[sum[i]];

  long long int ans = 0;
  for(const auto& e : m)
    if(e.second > 1) ans += e.second*(e.second-1)/2;
  
  cout << ans << endl;
}

Measured memory_bytes: 5260
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int n, d;
  cin >> n >> d;
  if (n % (2 * d + 1) == 0) P(n / (2 * d + 1));
  else P(n / (2 * d + 1) + 1);


  return 0;
}

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

using namespace std;
using ll = long long;

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

int main() {
  int n = 5;
  int a[n];
  rep(i, n) cin >> a[i];

  int mx = 0;
  rep(i, n) {
    if (a[i] % 10 == 0) continue;
    mx = max(mx, 10 - a[i] % 10);
  }

  int ans = 0;
  rep(i, n) {
    ans += a[i] / 10 * 10;
    if (a[i] % 10 != 0) ans += 10;
  }
  ans -= mx;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long int n,ans,a;
    a=1000000007;
    ans=1;
    cin >> n;
    for(int i=1;i<=n;i++){
     ans=ans*i%a;
   }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

void solve() {
	int n, k; string s; cin >> n >> k >> s;
	k--;
	int z = s[k] - 'A';
	s[k] = 'a' + z;
	cout << s << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//experi(4);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc  = new Scanner(System.in);
      	int n = sc.nextInt();
      	int a = sc.nextInt();
      	n = n % 500;
      	if(n <= a){
          	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
      	
    }
}

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

long long gcm(long long a, long long b){
    if(a < b) return gcm(b, a);
    if(a % b == 0) return b;
    return gcm(b, a%b);
}

long long lcm(long long  a, long long b){
    return a / gcm(a,b) * b;
}

int main()
{
    int a,b;
    cin >> a >> b;
    cout << lcm(a,b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
using lint=long long;
int main(){
  lint Q,H,S,D,N;
  cin>>Q>>H>>S>>D>>N;
  lint iti=min(4*Q,2*H);
  iti=min(iti,S);
  lint ans=0;
  if(2*iti<D) ans=N*iti;
  else ans=N/2*D+N%2*iti;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; }
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    int n,k;
    string s;
    cin >> n >> k >> s;
    int ans = 0;
    char start = s[0];
    char bef = 'n';
    int now = 0;
    bool isChange = false;
    rep(i,n){
        if(bef != s[i]){
            isChange = false;
            ans += now;
            now = 0;
            if(s[i] != start && k > 0){
                k--;
                ans += 2;
                isChange = true;
            }
        }else{
            now++;
        }
        bef = s[i];
    }
    ans += now;
    if(isChange) ans--;
    cout << ans << endl;
}

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

int main()
{
   ll a , b , c ,d,mx  = 0;
   cin >> a ;
   string s;
   cin >> s;
   ll cnt = 0;
   for(int i=0; i<s.size(); i++)
   {
       if(s[i]=='I')cnt++;
       else cnt--;
       mx = max(mx,cnt);
   }
   cout << mx << endl;

}


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

int main() {
  int N; 
  cin >> N; 
  int S = 0; 
  for (int i = 0; i < N; i++) {
  int a, b; 
  cin >> a >> b; 
  S += b - a + 1; 
  }
  cout << S << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

int main(){
  string s, str1, str2;
  cin >> s;
  ll n = s.length();
  str1 = s.substr(0, (n-1)/2);
  str2 = s.substr((n+3)/2-1);
  reverse(str2.begin(), str2.end());
  for(ll i=0;i<str1.length();i++){
    if(str1[i] != str2[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  string check = str1;
  reverse(check.begin(), check.end());
  for(ll i=0;i<str1.length();i++){
    if(str1[i] != check[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int a[n][3];
  for(int i=0;i<n;i++)cin>>a[i][0]>>a[i][1]>>a[i][2];
  int dp[n+1][3];
  for(int i=0;i<=n;i++)for(int j=0;j<3;j++)dp[i][j]=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(j==k)continue;
        dp[i+1][k]=max(dp[i][j]+a[i][k],dp[i+1][k]);
      }
    }
  }
  int ans=max(dp[n][0],dp[n][1]);
  cout<<max(dp[n][2],ans)<<endl;
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
#define MOD 1000000007
//scanf("%d", &a) '\n'

int main() {
	int n;
	cin >> n;
	vector<int> a(100001, 0);
	vector<int> b(100001, 0);
	rep(i, n) {
		int v;
		scanf("%d", &v); '\n';
		if (i % 2 == 0) a[v]++;
		else b[v]++;
	}
	int ma = 0;
	int na = 0;
	int mb = 0;
	int nb = 0;
	rep2(i, 1, 100001) {
		if (a[i] > a[ma]) {
			na = ma;
			ma = i;
		}
		else if (a[i] > a[na]) {
			na = i;
		}
		if (b[i] > b[mb]) {
			nb = mb;
			mb = i;
		}
		else if (b[i] > b[nb]) {
			nb = i;
		}
	}
	if (ma != mb) {
		cout << n - a[ma] - b[mb] << endl;
	}
	else {
		cout << n - max(a[ma] + b[nb], a[na] + b[mb]) << endl;
	}
}
	

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

vector<string> s;
int n, l;

int main() {
  cin >> n >> l;
  for(int i = 0; i < n; ++i) {
    string x;
    cin >> x;
    s.push_back(x);
  }
  sort(s.begin(), s.end());
  for(int i = 0; i < n; ++i) cout << s[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        double r = scan.nextDouble();
        double s,o;
        s=r*r*Math.PI;
        o=2*r*Math.PI;

        System.out.printf("%f %f",s,o);
    }
}


Measured memory_bytes: 28328
# coding: UTF-8


N, _ = input().split()
N = int(N)

dislike_nums = input().split()

def contains_dislike_number(num):
    for n in dislike_nums:
        if n in str(i):
            return True
    return False

for i in range(N, 10*N+1):
    if not contains_dislike_number(i):
        print(i)
        break




Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

int n;
int cnt=0;

void solve(){
  cin >> n;
  if(n<1200)cout << "ABC";
  else cout << "ARC";
  cout << endl;

}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
using System;

public class Hello{
    public static void Main(){
        // Your code here!
        
        int p,q,r;
        string[] mofu = Console.ReadLine().Split(' ');

        p = int.Parse(mofu[0]);
        q = int.Parse(mofu[1]);
        r = int.Parse(mofu[2]);
      
      	int ans = p + q;
      	
      	if(ans > q + r){
          ans = q + r;
        }
      if(ans > r + p){
        ans = r + p;
      }
      
        
        System.Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vi vector<int>

int main(){
  

  int n;
  cin>>n;
  
  vector<ll> a(n+2);
  
  vector<ll> b(n+1);
  
  for (int i=1;i<=n+1;i++){
    ll tmp;
    cin>>tmp;
    a.at(i)=tmp;
  }
  
  for (int i=1;i<=n;i++){
    ll tmp;
    cin>>tmp;
    b.at(i)=tmp;
  }

  ll answer=0;
  
  for (int i=1;i<=n;i++){
    ll tmp1=min(b.at(i),a.at(i));
    answer+=tmp1;
    ll tmp2=min(b.at(i)-tmp1,a.at(i+1));
    answer+=tmp2;
    a.at(i+1)-=tmp2;
  }
  
  cout<<answer<<endl;
  

  
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int main(){
    int N,M;
    cin >> N >> M;
    cout << (1900 * M + 100 *(N - M)) * pow(2,M);
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  if(n>=30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

//#define DEBUG 1

#define for0(i,n) for (int i=0; i<n; i++)
#define iter(c) for(auto it=c.begin(); it!=c.end(); it++)
#define iter2(c) for(auto it2=c.begin(); it2!=c.end(); it2++)
#define pb push_back
#define ms(a,z) memset(a,z,sizeof(a));
#define mp make_pair
#define X first
#define Y second
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define all(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define pmod(x,m) (((x)%(m)+m)%m)
#ifdef int
#define read(x) scanf("%lld",&x);
#else
#define read(x) scanf("%d",&x);
#endif

#ifdef DEBUG
#define nl cout<<"\n";
#define pr(x) cout<<(x)<<" ";
#define prl(x) cout<<#x " = "<<x<<endl;
#define prp(x) cout<<"("<<(x).first<<" "<<(x).second<<") ";
#define printv(v) {for(int _=0; _<sz(v); _++) cout<<v[_]<<" "; cout<<"\n";}
#define printa(a,s) {for (int _=0; _<s; _++) cout<<a[_]<<" "; cout<<"\n";}
#define print2D(a,m,n) {for (int _=0; _<m; _++) {for (int __=0; __<n; __++) cout<<a[_][__]<<" "; cout<<"\n";} cout<<"\n";}
#define debug cout<<"ok at line "<<__LINE__<<endl;
#else
#define nl
#define pr(x)
#define prl(x)
#define prp(x)
#define printv(v)
#define printa(a,s)
#define print2D(a,m,n)
#define debug
#endif

using namespace std;

typedef long long ll;

const int INF = 999999999;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;

int mask[200005];
int best_val[(1<<26)+10];
int dp[200005];

int get_val(int i, int goal_mask)
{
    int req_mask = goal_mask ^ mask[i-1];
    if (best_val[req_mask] == INF)
        return INF;
    else 
        return best_val[req_mask]+1;
}

int32_t main()
{
    #ifdef DEBUG
    freopen("D.txt","r",stdin);
    //freopen("","w",stdout);
    #endif

    string s;
    cin >> s;
    int n = s.length();
    for0(i,(1<<26))
        best_val[i] = INF;
        
    int cur_mask = 0;
    mask[0] = 0;
    for (int i=0; i<n; i++) {
        cur_mask ^= 1<<(s[i]-'a');
        mask[i+1] = cur_mask;
    }
    
    //printa(mask,n+1);
    dp[n] = 1;
    best_val[mask[n]] = 0;
    
    for (int i=n-1; i>=1; i--) {
        best_val[mask[i]] = min(best_val[mask[i]], dp[i+1]);    
        
        int ans = get_val(i,0);
        for (int b=0; b<26; b++) {
            int res = get_val(i,1<<b);
            ans = min(ans,res);
        }
        ans = min(ans,dp[i+1]+1);
        dp[i] = ans;
        //pr(i) pr(ans) nl 
    }
    printa(dp,n+1)
    
    cout<<dp[1]<<endl;
    return 0;
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int N = 1e5 + 3;
int h[N];
int dp[N];

int main() {
    ios_base::sync_with_stdio(false);
    memset(dp, INF,sizeof dp);

    int n,k; cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> h[i];

    dp[0] = 0;
    for(int i = 1; i < n; i++)
        for(int j = max(0,i-k); j < i; j++)
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));

    cout << dp[n-1] << endl;
    return 0;
}


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

using namespace std;

int main () {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int N, ans = 0;
    scanf("%d", &N);
    vector <int> numbers(N);
    for(int i = 0; i < N; i += 1) {
        scanf("%d", &numbers[i]);
    }
    for(int i = 1; i < N; i += 1) {
        if(numbers[i] == numbers[i - 1]) {
            int cnt = 1;
            int j = i;
            while(numbers[i] == numbers[j]) {
                i += 1;
                cnt += 1;
            }
            ans += cnt / 2;
            i -= 1;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

#define FOR(i,n) for(ll i=0;i<n;i++)

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   string N;
   cin >> N;
   ull sum = 0;
   ull n = 0;
   FOR(i,N.size()){
      n *= 10;
      sum+=(N[i]-'0');
      n += (N[i]-'0');
   }
   if(n%sum==0)cout << "Yes" << endl;
   else cout << "No" << endl;
   return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np


def main():
	n,k=map(int,input().split())
	A=list(map(int,input().split()))
	A.sort()
	
	comb=[1]
	for i in range(n-k):
		comb.append((comb[-1]*(k+i)*pow(i+1,mod-2,mod))%mod)
	ans=0
	
	for i in range(n-k+1):
		ans+=((comb[i]*A[k-1+i])-(comb[i]*A[n-k-i]))%mod
		ans=ans%mod
	print(ans)


if __name__ == "__main__":
	main()


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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

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

using namespace std;

int main(void) {
	const int N = 100001;
	vector<bool> sieve(N, true);
	sieve[0] = false;
	sieve[1] = false;
	for(int i = 2; i < N; ++i) {
		for(int j = 2; i * j < N; ++j) {
			sieve[i * j] = false;
		}
	}
	vector<int> imos;//imos[i] = \sum_{0 <= k <= i, sieve[k] == true} 1
	imos.push_back(0);
	for(int i = 1; i < N; ++i) {
		if(sieve[i] && sieve[(i + 1) / 2]) {
			imos.push_back(imos.back() + 1);
		} else {
			imos.push_back(imos.back());
		}
	}
	int Q;
	cin >> Q;
	for(int i = 0; i < Q; ++i) {
		int l, r;
		cin >> l >> r;
		cout << (imos[r] - imos[l - 1]) << '\n';
	}
	return 0;
}



Measured memory_bytes: 1148
H, W = map(int, input().split())
pixels = []
for i in range(H):
    pixels.append([c for c in input()])

for i in range(H):
    row = pixels[i]
    for pixel in row:
        print(pixel, end="")
    print()
    for pixel in row:
        print(pixel, end="")
    print()

Measured memory_bytes: 4472
#include <iostream>
//#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb(x) push_back(x)
#define F first
#define S second
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	vector<int> a;
	int b;
	loop(i,0,3){
		cin>>b;
		a.pb(b);
	}
	sort(a.begin(),a.end());
	if(a[0]==5 && a[1]==5 && a[2]==7){
		puts("YES");
	}
	else puts("NO");



	return 0;
}



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

using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  int a[n+1] = {};
  for(int i=0;i<n;i++){
    int tmp;
    cin >> tmp;
    a[tmp]++;
  }
  //for(int i=1;i<n+1;i++)cout << a[i];
  //cout << endl;
  sort(a+1, a+n+1);
  //for(int i=1;i<n+1;i++)cout << a[i];
  //cout << endl;
  
  int min_idx=0;
  for(int i=1;i<n+1;i++){
    if(a[i]>0){
      min_idx=i;
      break;
    }
  }
  int ans=0;
  //cout << "minidx;" << min_idx << endl;
  //cout << "nk1:" << n-k-1 << endl;
  if(min_idx>n-k)ans=0;
  else{
    for(int i=min_idx;i<=n-k;i++)ans+=a[i];
  }
  cout << ans<< endl;

}

Measured memory_bytes: 1024
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
#define N 101010
void build(){

}
LL r , c , n;
LL x[ N ][ 2 ];
LL y[ N ][ 2 ];
bool on_border( LL xi , LL yi ){
  return xi == 0 or xi == r or
         yi == 0 or yi == c;
}
LL at( LL xi , LL yi ){
  if( yi == 0 ) return xi;
  if( xi == r ) return r + yi;
  if( yi == c ) return r + c + ( r - xi );
  return r + r + c + ( c - yi );
}
vector< pair<LL,LL> > vv;
void init(){
  r = getint();
  c = getint();
  n = getint();
  for( int i = 1 ; i <= n ; i ++ ){
    for( int j = 0 ; j < 2 ; j ++ ){
      x[ i ][ j ] = getint();
      y[ i ][ j ] = getint();
    }
    if( on_border( x[ i ][ 0 ] , y[ i ][ 0 ] ) and
        on_border( x[ i ][ 1 ] , y[ i ][ 1 ] ) ){
      LL at1 = at( x[ i ][ 0 ] , y[ i ][ 0 ] );
      LL at2 = at( x[ i ][ 1 ] , y[ i ][ 1 ] );
      if( at1 > at2 ) swap( at1 , at2 );
      for( LL dlt = 0 ; dlt < 3 ; dlt ++ ){
        vv.push_back( { at1 + ( r * 2 + c * 2 ) * dlt , +i } );
        vv.push_back( { at2 + ( r * 2 + c * 2 ) * dlt , -i } );
      }
    }
  }
}
void solve(){
  sort( vv.begin() , vv.end() );
  vector<LL> stk;
  for( auto i : vv ){
    if( i.second < 0 ){
      if( stk.empty() or stk.back() != -i.second ){
        puts( "NO" );
        Bye;
      }
      stk.pop_back();
    }else
      stk.push_back( i.second );
  }
  if( stk.size() )
    puts( "NO" );
  else
    puts( "YES" );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 21224