akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

ll a,b,c;
cin >> a >> b >> c;
if(a % 2 == 1 && b % 2 == 1 && c % 2 == 1) {
    ll S = min(a*b,min(b*c,c*a));
    cout << S << endl;
}
else cout << 0 << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n;
    std::cin >> n;
    std::vector<std::vector<int>> a(2, std::vector<int>(n, 0));
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < n; j++){
            std::cin >> a[i][j];
        }
    }

    int res = 0;
    for(int i = 0; i < n; i++){
        int up = std::accumulate(a[0].begin(), a[0].end() - n + i + 1, 0);
        int dw = std::accumulate(a[1].begin() + i, a[1].end(), 0);
        if(res < up + dw){
            res = up +dw;
        }
    }
    std::cout<<res<<std::endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

signed main(void) {
	ll i, j, k, l;
	ll N,x;
	ll a[2005];
	cin >> N >> x;
	rep(i, N) cin >> a[i];
	//ll magic_cost = 0;
	//ll cost2 = 0;
	//static ll memo[2005][2005];
	//rep(i, 2005) rep(j, 2005) memo[i][j] = (ll)1e18;
	//rep(i, N) {
	//	rep(j, N) {
	//		ll b = j - i;
	//		if (b < 0) b += N;
	//		memo[i][b] = b*x;
	//	}
	//}
	ll cost = (ll)1e18;
	ll memo2[2005]; // b*x
	rep(i, 2005) memo2[i] = (ll)1e18;
	rep(i, N) {
		ll i_cost = i*x;
		rep(j, N) {
			memo2[j] = min(memo2[j], a[(j - i + N) % N]);
			i_cost += memo2[j];
		}
		if (i_cost < cost) cost = i_cost;
	}
	cout << cost << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

using namespace std;
#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)

int N;
double dp[301][301][301];
double dfs(int a, int b, int c) {
  if (a == 0 && b == 0 && c == 0)
    return 0;
  if (dp[a][b][c] != -1)
    return dp[a][b][c];
  double ans = 1.0 * N / (a + b + c);
  if (a > 0) ans += 1.0 * a / (a + b + c) * dfs(a-1, b, c);
  if (b > 0) ans += 1.0 * b / (a + b + c) * dfs(a+1, b-1, c);
  if (c > 0) ans += 1.0 * c / (a + b + c) * dfs(a, b+1, c-1);
  return dp[a][b][c] = ans;
}
int main() {
  in(N);

  rep(i, 301) rep(j, 301) rep(k, 301) dp[i][j][k] = -1;
  int v[4] = {0,0,0,0};
  rep(i, N) {
    int in(a);
    ++v[a];
  }
  cout << fixed << setprecision(15) << dfs(v[1], v[2], v[3]) << endl;

  return 0;
}


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

using namespace std;

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


    string s, t;
    cin >> s >> t;

    int siz = s.length();
    int si = t.length();

    int ans = 1e9;
    for(int i = 0; i + si <= siz; i++){
        string sub = s.substr(i, si);
        int cnt = 0;
        for(int j = 0; j < si; j++){
            if(sub[j] != t[j]){
                cnt++;
            }
        }
        ans = min(ans, cnt);
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    int N;
    cin >> N;
    vector <string> S(N);
    map<string , int> T;
    rep(i , N){
        cin >> S[i];
        T[S[i]]++;
    }
    int maxcnt = 0;
    for (pair<string, int> p: T) {
        if (maxcnt < p.second) {
            maxcnt = p.second;
        }
    }
    vector<string> answer;
    for (pair<string, int> p: T) {
        if (maxcnt == p.second) {
            answer.push_back(p.first);
        }
    }
    sort(answer.begin(), answer.end());
    for (const auto &s: answer) {
        cout << s << endl;
    }
}


Measured memory_bytes: 33432
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

vector<int> fact;
vector<int> ifact;
vector<int> inv;
vector<int> pow2;
const int MOD = (1e9 + 7);
int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}
int modpow(int a, int b)
{
	int r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
int choose(int a, int b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	return mult(fact[a],mult(ifact[b],ifact[a-b]));
}
int inverse(int a)
{
	return modpow(a,MOD-2);
}
void init(int _n)
{
	fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
	fact.resize(_n+1);
	ifact.resize(_n+1);
	inv.resize(_n+1);
	pow2.resize(_n+1);
	pow2[0]=1;
	ifact[0]=1;
	fact[0]=1;
	for(int i=1;i<=_n;i++)
	{
		pow2[i]=add(pow2[i-1],pow2[i-1]);
		fact[i]=mult(fact[i-1],i);
		//ifact[i]=mult(ifact[i-1],inv[i]);
	}
	ifact[_n] = inverse(fact[_n]);
	for(int i=_n-1;i>=1;i--)
	{
		ifact[i] = mult(ifact[i + 1], i + 1);
	}
	for(int i=1;i<=_n;i++)
	{
		inv[i] = mult(fact[i-1],ifact[i]);
	}
}

int F[5555];
int dp[5555][5555];
int sub[5555];
vi adj[5555];
void dfs(int u, int p=-1)
{
	sub[u]=1;
	vector<int> pre; pre.pb(0); pre.pb(1);
	for(int v:adj[u])
	{
		if(v==p) continue;
		dfs(v,u);
		sub[u]+=sub[v];
		int res=0;
		for(int j=2;j<=sub[v];j+=2)
		{
			res=add(mult(F[j],dp[v][j]),res);
		}
		//cerr<<sum[0]<<' '<<sum[1]<<'\n';
		vector<int> nw;
		nw.assign(sub[u]+1,0);
		
		for(int i=0;i<=sub[v];i++) //take i from this sub
		{
			for(int j=i;j<=sub[u]-sub[v]+i;j++)
			{
				if(i>0) nw[j] = add(nw[j], mult(pre[j-i], dp[v][i]));
				else nw[j] = add(nw[j], MOD- mult(pre[j], res));
			}
		}
		pre=nw;
	}
	for(int i=0;i<pre.size();i++)
	{
		dp[u][i] = pre[i];
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	init(100000);
	int n; cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int u,v; cin>>u>>v; u--; v--;
		adj[u].pb(v); adj[v].pb(u);
	}
	for(int i=0;i<=n;i++)
	{
		if(i&1) F[i]=0;
		else F[i] = mult(fact[i], mult(ifact[i/2], inverse(pow2[i/2])));
	}
	dfs(0,-1);
	int ans=0;
	for(int i=0;i<=n;i++)
	{
		ans=add(ans,mult(F[i],dp[0][i]));
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 112764
n = int(input())
A = list(map(int,input().split()))
from collections import Counter

c = Counter(A)
# print(c)
cou = 0
for x in c:
    # print(x,c[x])
    if c[x]>1:
        y = c[x]
        cou+=y*(y-1)//2



for i in A:
    X = c[i]
    ans = cou - X*(X-1)//2 + (X-1)*(X-2)//2
    print(ans)


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

int a, b, c, k, ans;

int main() {
  cin >> a >> b >> c >> k;
  ans = min(k, a);
  k -= a;
  if (k > 0) k -= b;
  if (k > 0) ans -= k;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();


// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    int n, q; string s; cin >> n >> q >> s;
    int ans = 0;
    vector<int> a(n,0);
    int count = 0;
    rep1(i,n) {
        if (s[i-1] == 'A' && s[i] == 'C'){
            count++;
        }
        a[i] = count;
    }
    rep(i,q) {
        int l, r; cin >> l >> r; l--; r--;
        cout << a[r] - a[l] << endl;
    }


}


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

#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef long long ll;

int main(){
  int n; cin >> n;
  vi a(n),b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];

  int ans = 0;

  rep(k,30){ // k bit目
    ll tmp = 0; // k bit目が1の数
    ll t = 1ll << k;
    vi c(n),d(n);
    rep(i,n){
      c[i] = a[i] % (2 * t);
      d[i] = b[i] % (2 * t);
    }
    sort(all(d));
    rep(i,n){ // a_i
      tmp += lower_bound(all(d),2*t-c[i]) - lower_bound(all(d),t-c[i]);
      tmp += lower_bound(all(d),4*t-c[i]) - lower_bound(all(d),3*t-c[i]);
    }
    if(tmp % 2 == 1) ans += t;
  }

  cout << ans << endl;
}

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

long long x, y;
int main() {
    cin >> x >> y;
    long long res = 1LL<<60;
    if (x <= y) res = min(res, y-x);
    if (-x <= y) res = min(res, y+x+1);
    if (x <= -y) res = min(res, -y-x+1);
    if (-x <= -y) res = min(res, -y+x+2);
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    i64 n;
    cin >> n;
    i64 m = 1;
    for (; m * (m + 1) / 2 < n; m++);
    vi ans;
    i64 sum = 0;
    for (int i = 1; i <= m; i++) {
        if (i != m * (m + 1) / 2 - n) {
            ans.push_back(i);
            sum += i;
        } 
    }
    for (i64 a : ans) {
        cout << a << endl;
    }
}

Measured memory_bytes: 512
import sys
input = lambda: sys.stdin.readline().rstrip()

N, M = map(int, input().split())

card = [0] * (N+1)
for i in range(M):
    L, R = map(int, input().split())
    card[L-1] += 1
    card[R] -= 1

for i in range(len(card)-1):
    card[i+1] += card[i]

print(card.count(M))

Measured memory_bytes: 78932
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N, M, K;
int H, W;
string S, T;
vector<string> A;
//=============================
void input()
{
    cin >> H >> W;
    A.resize(H);
    rep(i, H)
    {
        cin >> A[i];
    }
}
//=============================
void func() {}
//=============================
void solve()
{
    vector<bool> h(H);
    vector<bool> w(W);

    rep(i,H){
        bool f = false;
        rep(j,W){
            if (A[i][j] == '#'){
                f = true;
                break;
            }
        }
        h[i] = f;
    }
    rep(j,W){
        bool f = false;
        rep(i,H){
            if (A[i][j] == '#'){
                f = true;
                break;
            }
        }
        w[j] = f;
    }

    rep(i,H){
        if (!h[i])continue;
        rep(j,W){
            if (!w[j])continue;
            cout<<A[i][j];
        }
        cout<<endl;
    }

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
	var s = scala.io.StdIn.readLine.toList.reverse
	val t = scala.io.StdIn.readLine.toList.reverse

	var flag = false

	for(i<-0 until s.size){
		if(s == t) flag = true
		var tp = s.head
		s = s.tail :+ tp
	}

	if(flag) println("Yes")
	else println("No")
}


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

int main(){
    int n,i,j;
    cin >> n ;
    vector<int> a(200001);
    for(i = 1;i <= n;i++){
        cin >> a.at(i);
    }

    int sum;
    int count = 0;
    vector<int> ball(200001, 0);
    for(i = n;i > 0;i--){
        sum = 0;
        for(j = 1;j*i <= n;j++){
            sum += ball.at(i*j);
        }
        if(sum%2 != a.at(i)){
            ball.at(i) = 1;
            count++;
        }
    }
    cout << count << endl;
    for(i = 1;i <= n;i++){
        if(ball.at(i) == 1){
            cout << i << " ";
        }
    }
    cout << endl;
}

Measured memory_bytes: 2688
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>

typedef long long ll;
typedef unsigned long long ull;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用


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

	int n;
	cin >> n;
	vector<pair<ll,ll>> x(n);
	vector<pair<ll, ll>> ans;
	vector<ll> ansCount;

	rep(i, n)
	{
		cin >> x[i].first >> x[i].second;
	}

	sort(x.begin(), x.end());
	bool notfound = true;
	for (int i = 0; i < n - 1; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			pair<ll, ll> tmp;
			tmp.first = x[j].first - x[i].first;
			tmp.second = x[j].second - x[i].second;
			for (int serch = 0; serch < ans.size(); serch++)
			{
				if (tmp.first == ans[serch].first && tmp.second == ans[serch].second)
				{
					ansCount[serch]++;
					notfound = false;
					break;
				}
				else
				{
					notfound = true;
				}
			}
			if (notfound)
			{
				ans.push_back(tmp);
				ansCount.push_back(1);
			}
		}
	}
	ll maxNum = 0;
	for (int i = 0; i < ansCount.size(); i++)
	{
		maxNum = max(maxNum, ansCount[i]);
	}

	cout << n - maxNum << endl;

}

Measured memory_bytes: 384
//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <ctime>
#include <bitset>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=a%10, a/=10; return res;}
const int up[]={1,-1,0,0}, lf[]={0,0,1,-1};

struct tup {
  int x,y,c;
  bool operator<(const tup tt) const {
    if (c != tt.c) return c < tt.c;
    else if (x != tt.x) return x < tt.x;
    else return y < tt.y;
  }
  bool operator>(const tup tt) const {
    if (c != tt.c) return c > tt.c;
    else if (x != tt.x) return x > tt.x;
    else return y > tt.y;
  }
};

int main() {
  int h,w; cin>>h>>w;
  int x0,y0,x1,y1; cin>>x0>>y0>>x1>>y1; x0--; y0--; x1--; y1--;
  string s[h];
  for(int i=0;i<h;i++) {
    cin>>s[i];
  }
  int cs[h][w]; fill(cs[0],cs[h],INF);
  cs[x0][y0] = 0;
  priority_queue<tup, vector<tup>, greater<tup>> que; que.push({x0,y0,0});
  while(!que.empty()) {
    tup tp = que.top(); que.pop();
    int x = tp.x; int y = tp.y; int cc = tp.c;
    if (tp.c > cs[x][y]) continue;
    for(int i=0;i<4;i++) {
      int tx = x + up[i], ty = y + lf[i];
      if (vaild(tx,ty,h,w) && s[tx][ty] == '.' && cc < cs[tx][ty]) {
        //cout<<tx<<" "<<ty<<" "<<cc<<endl;
        cs[tx][ty] = cc;
        que.push({tx,ty,cc});
      }
    }
    for(int i=-2;i<=2;i++) {
      for(int j=-2;j<=2;j++) {
        if (abs(i)+abs(j)>5) continue;
        int tx = x + i, ty = y + j;
        if (vaild(tx,ty,h,w) && s[tx][ty] == '.' && cc+1 < cs[tx][ty]) {
          cs[tx][ty] = cc+1;
          que.push({tx,ty,cc+1});
        }
      }
    }
  }

  if (cs[x1][y1] == INF) {
    cout<<-1<<endl;
  } else {
    cout<<cs[x1][y1]<<endl;
  }
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest


Measured memory_bytes: 9456
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  A = list(map(int, input().split()))
  MOD = 1_000_000_007

  mem0 = [[0]*60 for _ in range(N+1)]
  mem1 = [[0]*60 for _ in range(N+1)]
  for i in range(1, N+1):
    # j 桁目について
    for j in range(60):
      if A[i-1] & (1 << j):
        mem1[i][j] = mem1[i-1][j] + 1
        mem0[i][j] = mem0[i-1][j]
      else:
        mem1[i][j] = mem1[i-1][j]
        mem0[i][j] = mem0[i-1][j] + 1

  sum_ = 0
  MAX = len(bin(max(A))) - 2
  for i in range(1, N+1):
    for j in range(MAX):
      if A[i-1] & (1 << j):
        sum_ += ( (1 << j)*(mem0[N][j] - mem0[i][j]) % MOD )
      else:
        sum_ += ( (1 << j)*(mem1[N][j] - mem1[i][j]) % MOD )

  print(sum_ % MOD)


if(__name__ == '__main__'):
  main()


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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int k, s;
    cin >> k >> s;

    // 処理
    int ans = 0;
    for (int i = 0; i <= k; i++) {
        for (int j = 0; j <= k; j++) {
            if (s - i - j >= 0 && s - i - j <= k) ans++;
        }
    }

    // 出力
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a1,a2,a3,zbir;
    cin>>a1>>a2>>a3;
    zbir=a1+a2+a3;
    if(zbir==22 or zbir>22){
        cout<<"bust";
    }
    else{
        cout<<"win";
    }
}


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


int N, M;
int k[10], s[10][10], p[10], mask[10];


int bit_count(int x){
    int ret = 0;
    for(int i = 0; i < 20; i++){
        if(1 & (x >> i)){
            ret++;
        }
    }
    return ret;
}

int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            cin >> s[i][j];
            s[i][j]--;
            mask[i] += (1 << s[i][j]);
        }
    }
    for(int i = 0; i < M; i++){
        cin >> p[i];
    }
    int ans = 0;
    for(int state = 0; state < (1 << N); state++){
        bool ok = true;
        for(int i = 0; i < M; i++){
            if(bit_count(mask[i] & state) % 2 != p[i]){
                ok = false;
            }
        }
        if(ok){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from sys import stdin
N = int(stdin.readline().rstrip())
if 400 <= N <= 599:
    print(8)
elif 600 <= N <= 799:
    print(7)
elif 800 <= N <= 999:
    print(6)
elif 1000 <= N <= 1199:
    print(5)
elif 1200 <= N <= 1399:
    print(4)
elif 1400 <= N <= 1599:
    print(3)
elif 1600 <= N <= 1799:
    print(2)
else:
    print(1)

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

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

    int len = s.length();
    int flag = 0;
    char end;

    for(int i = 0; i < len; i++){
        if(s == t){
            flag = 1;
            break;
        }else{
            end = s[len - 1];
            s.erase(len - 1, 1);
            s = end + s;
        }
    }

    if(flag == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long LL;
const int MX = 1e3+7;
const int mod = 1e9+7;
int n,m,K;
LL fac[MX], inv[MX];
LL ans = 1;

void init()
{
    int n = 1e3;
    fac[0] = fac[1] = inv[0] = inv[1] = 1;
    for(int i = 2; i <= n; i++){
        fac[i] = fac[i-1]*i%mod;
        inv[i] = (mod-mod/i)*inv[mod%i]%mod;
    }
    for(int i = 2; i <= n; i++)
        inv[i] = inv[i]*inv[i-1]%mod;
}

LL qpow(LL a, LL n)
{
    LL ret = 1;
    while(n){
        if(n&1) ret = ret * a %mod;
        a = a*a%mod;
        n >>= 1;
    }
    return ret;
}

LL polya(int m)
{
    LL ret = 0;
    for(int i = 1; i <= m; i++){
        ret += qpow(K,__gcd(i,m));
        ret %= mod;
    }
    return (ret*qpow(m,mod-2))%mod;
}

LL C(int n, int m)
{
    if(n < m) return 0;
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}

struct edge{
    int v;
    bool vis;
    edge *nxt,*rev;
}*con[MX],*stc[MX];

int dfn[MX],low[MX],tim,top;
bool vis[MX];

void add(int u, int v)
{
    edge *p = new edge;
    p->v = v;   p->vis = 0;
    p->nxt = con[u];
    con[u] = p;
}
void get_rev(int u, int v)
{
    con[u]->rev = con[v];
    con[v]->rev = con[u];
}

void tarjan(int u)
{
    dfn[u] = low[u] = ++tim;
    for(edge *p = con[u]; p; p = p->nxt){
        if(p->vis || p->rev->vis) continue;
        stc[++top] = p;
        p->vis = p->rev->vis = 1;
        if(!dfn[p->v]){
            tarjan(p->v);
            low[u] = min(low[u], low[p->v]);
            if(low[p->v] >= dfn[u]) {
                bool cir = 1;   //用来判断一个环的点双联通分量与多重环的点双联通分量
                int cnt = 0;
                for(int i = top; stc[i+1] != p; --i,++cnt){
                    if(vis[stc[i]->v]) cir = 0;
                    else vis[stc[i]->v] = 1;
                }
                for(; stc[top+1] != p; --top) vis[stc[top]->v] = 0;

                if(cir) ans = (ans*polya(cnt))%mod;
                else ans = (ans*C(cnt+K-1,K-1))%mod;
                ans %= mod;
            }
        }
        else low[u] = min(low[u],dfn[p->v]);
    }
}

int main()
{
    init();
    scanf("%d%d%d",&n,&m,&K);
    for(int i = 1,u,v; i <= m; i++){
        scanf("%d%d",&u,&v);
        add(u,v);   add(v,u);
        get_rev(u,v);
    }
    for(int i = 1; i <= n; i++)
        if(!dfn[i]) tarjan(i);
    printf("%lld\n",ans);
    return 0;
}

/*
4 4 2
1 2
2 3
3 1
3 4
*/


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cstring>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <stack>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int maxn = 1000050;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const ll linf = 2e18;
ll power(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = ans * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ans;
}

ll gcd(ll x, ll y)
{
    if (x % y == 0)
        return y;
    return gcd(y, x % y);
}

int main()
{
    int i, j, k, t, n;
    double a, b, h, m;
    scanf("%lf %lf %lf %lf", &a, &b, &h, &m);
    if (a > b)
        swap(a, b);
    double x = h * 30 + m / 2, y = m * 6, z = fabs(x - y);

    if (z > 180)
        z = 360 - z;
    double v = acos(-1) * z / 180, ans;
    //printf("%.5f %.5f\n", z, v);
    if (z == 0)
        ans = fabs(a - b);
    else if (z == 90)
        ans = sqrt(a * a + b * b);
    else if (z == 180)
        ans = a + b;
    else if (z < 90)
    {
        x = sin(v) * a;
        y = cos(v) * a;
        z = b - y;
        ans = sqrt(x * x + z * z);
    }
    else
    {
        v = acos(-1) - v;
        x = sin(v) * a;
        y = cos(v) * a;
        z = b + y;
        ans = sqrt(x * x + z * z);
    }
    printf("%.13f\n", ans);
    return 0;
}


Measured memory_bytes: 4004
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
import math
import time
ts=time.time()
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

n=I()
t=[]
d=[]
nx=[0]*n
for i in range(n):
    a=[i-1 for i in LI()[::-1]]
    nx[i]=a.pop()
    t.append(a)
    d.append([-1]*(n))

flg=True
ans=0
MacthNum=0
yet=set(range(n))
n_yet=set(range(n))
while flg and MacthNum<n*(n-1)//2:
    elp=time.time()-ts
    if elp>1.8:
        ans=0#n*(n-1)//2
        break
    ans+=1
    IsMatch=False
    done=set()
    n_yet=[]
    #print('Day',ans,IsMatch,nx)
    for i in yet:
        if (i in done) or (nx[i] in done) or nx[i]==n:
            continue
        c1=i
        c2=nx[i]
        if c1==nx[c2]:
            IsMatch=True
            MacthNum+=1
            #print('Day',ans,'Match',c1,'vs',c2)
            if t[c1]:
                n_i=t[c1].pop()
                n_yet.append(c1)
            else:
                n_i=n
            if t[c2]:
                n_n_i=t[c2].pop()
                n_yet.append(c2)
            else:
                n_n_i=n
            #print(i,nx[i],nx)
            nx[nx[i]],nx[i]=n_n_i,n_i
            done.add(c1)
            done.add(c2)
            #print('i,t,d',i,t,'done=',done,'nx=',nx,n_i,n_n_i)
    yet=[i for i in n_yet]
    ans=ans if IsMatch else -1
    flg=True if IsMatch else False

print(ans)


Measured memory_bytes: 73560
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    ll n,m;
    cin>>n>>m;
    ll r=0;
    ll mis=0;
    vector<int> v(100010,0);
    S a;
    for(int i = 0;i < m; i++){
        int b;
        string s;
        cin>>b>>s;
        if(s=="AC"){
            if(a.find(b)==a.end()){
                r++;
                mis+=v[b];
                a.insert(b);
            }
        }
        else if(s=="WA"){
            if(a.find(b)==a.end()){
                v[b]++;
            }
        }
    }
    cout<<r<<" "<<mis<<endl;
    return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <algorithm> // max, min

using namespace std;

const int AllaySize = 1000;
const int Limit = 999999;

int N, P;
int ConnectR[AllaySize][AllaySize];
int InitTTL;
//int Ans[AllaySize][AllaySize];

void war(void) {
  for(int k=1; k<N+1; k++) {
    for(int i=1; i<N+1; i++) {
      for(int j=1; j<N+1; j++) {
	ConnectR[i][j]=min(ConnectR[i][j], ConnectR[i][k]+ConnectR[k][j]);
      }
    }
  } 
}

int main(void) {
  for(int i=0; i<AllaySize; i++) {
    for(int j=0; j<AllaySize; j++) {
      ConnectR[i][j]=Limit;
      // Ans[i][j]=Limit;
    }
  }

  cin>>N;
  for(int i=0; i<N; i++) { // ルータの接続情報
    int k;
    int from, to;
    cin>>from;
    cin>>k;
    for(int j=0; j<k; j++) {
      cin>>to;
      ConnectR[from][to] = 1; // 通過可能
    }
  }

  war();
  cin>>P;
  for(int i=0; i<P; i++) {
    int from, to;
    cin>>from;
    cin>>to;
    cin>>InitTTL;
    if(ConnectR[from][to] < InitTTL) {
      cout<<ConnectR[from][to]+1<<endl; // ?????
    }
    else {
      cout<<"NA"<<endl;
    }
  }
  /*
  for(int i=0; i<N; i++)
    for(int j=0; j<N; j++)
      cout<<ConnectR[i][j]<<" ";
  */
}

Measured memory_bytes: 5068
import bisect
N=input()
S=list(input())
alphabet=[[] for _ in range(26)]
for i,s in enumerate(S):
    alphabet[ord(s)-ord('a')].append(i)
Q=int(input())
for _ in range(Q):
    Type,A,B=input().split()
    if Type=="1":
        A=int(A)
        s=S[A-1]
        if s==B:
            continue
        o=ord(s)-ord("a")
        alphabet[o].pop(bisect.bisect_left(alphabet[o],A-1))
        index=bisect.bisect(alphabet[ord(B)-ord("a")],A-1)
        alphabet[ord(B)-ord("a")].insert(index,A-1)
        S[A-1]=B
    else:
        A=int(A)
        B=int(B)
        ans=0
        for i in range(26):
            indexL=bisect.bisect_left(alphabet[i],A-1)
            #indexR=bisect.bisect_right(alphabet[i],B-1)
            #ans+=(indexL!=indexR)
            if indexL==len(alphabet[i]):
                continue
            ans+=(alphabet[i][indexL]<=B-1)
        print(ans)


Measured memory_bytes: 30472
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int main(){
  string s;
  cin >> s;
  vi cnt(2 , 0);
  for(auto ch : s)
    cnt[ch - '0']++;
  int l = 0 , r = sz(s) - 1;
  int ans = sz(s);
  while(cnt[0] && cnt[1]) {
    cnt[s[l++] - '0']--;
    cnt[s[r--] - '0']--;
    --ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <stdio.h>
#include <fstream>

int main(){
	std::ofstream fout("debug.txt");
	int people,kind;

	std::cin >> people >> kind ;
	fout << people << "\t" <<kind << "\n";

	int K1,K2,a;
	std::vector<int> A1,A2;
	std::vector<int> buf;
	std::string s;


	std::cin >> K1;
	fout << "K1: "<<K1 << "\n";

	for (int t = 0; t < K1; t++){
		std::cin >> a;
		A1.push_back(a);
	}

	// for (int t = 0; t < K1; t++){
	// 	fout <<A1[t] << ",";
	// 	if(t == K1-1)
	// 		fout << "\n";
	// }

	if(people ==1)
		std::cout << A1.size()<<"\n";

	else{
		for (int i = 0; i < people-1; i++)
		{	
			buf.clear();
			A2.clear();
			std::cin >> K2;
			fout << "K2: "<<K2 << "\n";

			for (int t = 0; t < K2; t++){
				std::cin >> a;
				A2.push_back(a);
			}

			// for (int t = 0; t < K2; t++)
			// {
			// 	fout << A2[t] << ",";
			// 	if(t == K2-1)fout << "\n";
			// }

			for (int j = 0; j < K1; j++){
				for (int l = 0; l < K2; l++){
					if(A2[l] == A1[j]){
						buf.push_back(A2[l]);
					}
				}
			}
			A1 = buf;
			K1 = buf.size();

			// for (int t = 0; t < K1; t++){
			// 	if(t==0)
			// 		fout << "buf: ";
			// 	fout <<A1[t] << ",";
			// 	if(t == K1-1)
			// 		fout << "\n";
			// }
		}
		std::cout << buf.size() << "\n";
	}

	fout.close();
	return 0;

}

Measured memory_bytes: 256
#
# abc144 b
#
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    N = int(input())

    for i in range(1, 10):
        for j in range(1, 10):
            if i*j == N:
                print("Yes")
                exit()
    print("No")


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """50"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """81"""
        output = """Yes"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


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

int main(){
  string S,T;
  cin >>S >>T;
  bool B=true;
  
  for(int i=0; i<S.size() ;i++){
    if(S[i] != T[i])
      B=false;
  }
  
  if(S.size()+1 != T.size())
    B=false;
  
  if(B)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}

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

#define INT(X) \
  ( *( (int *)(X) ) )

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

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    int d[ 50 ];
    int n;

    scanf ( "%d", &n );
    if ( !n ) break ;

    for ( i = 0; i < n; ++i )
    {
      scanf ( "%d", d + i );
    }
    qsort ( d, n, sizeof ( int ), cmp );

    printf ( "%d", *d );
    for ( i = 1; i < n; ++i )
    {
      if ( d[ i ] - d[ i - 1 ] == 1 )
      {
        while ( i + 1 < n && d[ i + 1 ] - d[ i ] == 1 ) ++i;
        printf ( "-%d", d[ i ] );
      }
      else
      {
        printf ( " %d", d[ i ] );
      }
    }
    puts ( "" );
  }

  return ( 0 );
}

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

int N, M, A, B;
int S, H, V;
int C, D;
char R[1000][1000];
int SI, SJ;

void incr() {
  ++SJ;
  if(SJ == M / 2) { SJ = 0; ++SI; }
}

int main() {
  cin >> N >> M >> A >> B;
  S = (N / 2) * (M / 2); H = (N % 2) * (M / 2); V = (M % 2) * (N / 2);
  C = max(0, A - H); D = max(0, B - V);
  bool sjh = N % 2 && M % 2 && N >= 3 && M >= 3 && C % 2 && D % 2 && C / 2 + D / 2 == S - 1;
  if(sjh || C / 2 + D / 2 + C % 2 + D % 2 <= S) {
    cout << "YES" << endl;
    for(int i = 0; i < N; ++i) for(int j = 0; j < M; ++j) R[i][j] = '.';
    if(A - C) {
      for(int r = 0, j = 0; r < A - C; ++r, j += 2) {
        R[N - 1][j] = '<'; R[N - 1][j + 1] = '>';
      }
    }
    if(B - D) {
      for(int r = 0, i = 0; r < B - D; ++r, i += 2) {
        R[i][M - 1] = '^'; R[i + 1][M - 1] = 'v';
      }
    }
    for(int r = 0; r < C / 2; ++r) {
      R[SI * 2][SJ * 2] = R[SI * 2 + 1][SJ * 2] = '<';
      R[SI * 2][SJ * 2 + 1] = R[SI * 2 + 1][SJ * 2 + 1] = '>';
      incr();
    }
    for(int r = 0; r < D / 2; ++r) {
      R[SI * 2][SJ * 2] = R[SI * 2][SJ * 2 + 1] = '^';
      R[SI * 2 + 1][SJ * 2] = R[SI * 2 + 1][SJ * 2 + 1] = 'v';
      incr();
    }
    if(C % 2) {
      R[SI * 2][SJ * 2] = '<'; R[SI * 2][SJ * 2 + 1] = '>';
      incr();
    }
    if(sjh) {
      R[N - 2][M - 3] = '^'; R[N - 1][M - 3] = 'v';
      R[N - 1][M - 2] = '<'; R[N - 1][M - 1] = '>';
    } else {
      if(D % 2) {
        R[SI * 2][SJ * 2] = '^'; R[SI * 2 + 1][SJ * 2] = 'v';
        incr();
      }
    }
    for(int i = 0; i < N; ++i) {
      for(int j = 0; j < M; ++j) cout << R[i][j];
      cout << endl;
    }
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = (int)Math.ceil(n / 1.08);
        String res = ":(";

        if(Math.floor(x * 1.08) == n) res = String.valueOf(x);
        System.out.println(res);
    }
}


Measured memory_bytes: 35576
import java.util.Scanner;

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

        while(input.hasNext()){
            int D = input.nextInt();
            int N = input.nextInt();
           
            if(N == 100){
                ++N;
            }

            System.out.print(N);
            for(int i = 0; i < D; ++i){
                 System.out.print("00");
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long N;
    cin >> N;
    int sum = 0;
    int power = 0;
    while (N % 2 == 0)
    {
        N >>= 1;
        power++;
    }
    sum += (int)((-1 + sqrt(1 + 8 * power)) / 2);
    for (int i = 3; i < sqrt(N) + 1; i += 2)
    {
        power = 0;
        while (N % i == 0)
        {
            N /= i;
            power++;
        }
        sum += (int)((-1 + sqrt(1 + 8 * power)) / 2);
    }
    if(N>1){
        sum++;
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e3 + 5;
const int INF = 0x3f3f3f3f;
#define DEBUG(x) cout << x << '\n'

ll n;
void run(){
    cin >> n;
    stack<int> s;
    while(n){
        if(n % 26 == 0){
            n /= 26, n--;
            s.push(26);
        }
        else{
            s.push(n % 26);
            n /= 26;
        }
    }
    while(s.size()) cout << char(s.top() + 'a' - 1), s.pop();
}
int main(){
#ifdef Irene
    freopen("in.txt", "r", stdin);
#endif // Irene
    ios::sync_with_stdio(false);

    run();
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  int n,k;
  cin>>n>>k;
  if( n%k==0 ) cout<<0<<endl;
  else cout<<1<<endl;
}


Measured memory_bytes: 256
// Code by gautam_verma
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("03")
#define n_l '\n'
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } string to_string(char c){ return string({c}); } template<size_t N> string to_string(bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgs(){;} template<typename Heads, typename... Tails> void dbgs(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgs(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgs(__VA_ARGS__); cout << endl;
#define MOD 1000000007
#define MOD9 1000000009
#define ull unsigned long long
#define ll long long
#define blaze ios::sync_with_stdio(false)
const double pie = 2 * acos(0.0);
#define prec(n) fixed<<setprecision(n)
#define pii pair <int, int>
#define pll pair <ll, ll> 
#define f (i, x, n) for (int i = x; i < n; i++)
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define all(v) v.begin(), v.end()
#define nicekarde(v) v.erase(unique(v.begin(), v.end()), v.end());
#define ff first
#define ss second
int main() {
	
	blaze;
	cin.tie(NULL);
	cin.tie(NULL);
	int n; cin >> n;
	string x; cin >> x;
	nicekarde(x);
	cout << x.size() << endl;


	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=1e5+7;
int a[MAXN];
int main () {
	int n;
	scanf ("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf ("%d",&a[i]);
	}
	int i=0;
	for (int j=1;j<n;j++) {
		if (a[j]<=a[n]) swap (a[++i],a[j]);
	}
	swap (a[++i],a[n]);
	for (int j=1;j<=n;j++) {
		if (j>1) printf (" ");
		if (j==i) printf ("[%d]",a[j]);
		else printf ("%d",a[j]);
	}
	printf ("\n");
    return 0;
}


Measured memory_bytes: 2976
/*|-----------|
  | templatka |
  |  Tomasz   |
  |   Zyla    |
  |-----------|*/

#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tiii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef set<int> si;
typedef set<ll> sll;
typedef list<int> li;
typedef list<ll> lll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef map<string,int> msi;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef unordered_map<string,int> umsi;
typedef queue<int> qi;
typedef queue<ll> qll;
typedef priority_queue<int> pqi;
typedef priority_queue<ll> pqll;

int tab[3];

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	
	cin >> tab[0] >> tab[1] >> tab[2];
	sort(tab, tab + 3);
	if(tab[0] == tab[1] && tab[2] != tab[1]) cout << "Yes\n";
	else if (tab[1] == tab[2] && tab[0] != tab[1]) cout << "Yes\n";
	else cout << "No\n";
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    int h,w;cin>>h>>w;
    vvin a(h,vin(w)),b(h,vin(w)),c(h,vin(w));
    rep(i,h)rep(j,w)cin>>a[i][j];
    rep(i,h)rep(j,w){
        cin>>b[i][j];
        c[i][j]=abs(a[i][j]-b[i][j]);
    }
    const int num=80*160*2+1;
    vector<vvin> dp(h,vvin(w,vin(num)));//0,1
    dp[0][0][80*160+c[0][0]]=1;
    dp[0][0][80*160-c[0][0]]=1;
    rep(i,h)rep(j,w)rep(k,num){
        if(j>0&&dp[i][j-1][k]){
            dp[i][j][k+c[i][j]]=1;
            dp[i][j][k-c[i][j]]=1;
        }
        if(i>0&&dp[i-1][j][k]){
            dp[i][j][k+c[i][j]]=1;
            dp[i][j][k-c[i][j]]=1;
        }
    }
    rep(i,num/2+1){
        if(dp[h-1][w-1][80*160+i]||dp[h-1][w-1][80*160-i]){
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 651636
#include <iostream>
#include <unordered_set>

int main()
{
    int N;
    std::cin >> N;

    std::unordered_set<std::string> set;
    for (int i = 0; i < N; ++i) {
        std::string s;
        std::cin >> s;
        set.emplace(s);
    }
    std::cout << set.size() << std::endl;
    return 0;
}

Measured memory_bytes: 17684
using System;
using System.Linq;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int N = int.Parse(str[0]);
            int K = int.Parse(str[1]);
            int[] barLength = Console.ReadLine()
                .Split(' ')
                .Select(s => int.Parse(s))
                .ToArray();
            Array.Sort(barLength);
            Array.Reverse(barLength);

            int result = 0;
            for (int i = 0; i < K; ++i)
            {
                result += barLength[i];
            }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 13524
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
#include <cmath>
#include <map>
#include <utility>
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int MOD=1e9+7;
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    vector<ll> a(n+1,0),b(m+1,0);
    for(int i=1;i<=n;i++){
        cin>>a[i];
        a[i]=a[i]+a[i-1];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
        b[i]=b[i]+b[i-1];
    }
    int ret=0;
    for(int i=0;i<=n;i++){
        if(k<a[i])continue;
        if(ret<(upper_bound(b.begin(),b.end(),(ll)k-a[i])-b.begin())+i-1)ret=(upper_bound(b.begin(),b.end(),k-a[i])-b.begin())+i-1;
    }
    cout<<ret<<endl;
}

Measured memory_bytes: 6424