akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

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

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

int dp[3005][3005];

int main(){
  string s, t; cin>>s>>t;
  int n=s.size(), m=t.size();
  
  rep(i,n){
    rep(j,m){
      if(s[i]==t[j]) dp[i+1][j+1]=dp[i][j]+1;
      else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    }
  }
  
  int now=dp[n][m];
  int i=n, j=m;
  string ans="";
  while(i>=1&&j>=1){
    if(dp[i-1][j]==now) i--;
    else if(dp[i][j-1]==now) j--;
    else if(dp[i-1][j-1]==now-1){
      ans+=s[i-1];
      now--; i--; j--;
    }
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
}
 

Measured memory_bytes: 35456
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  ll a,b;
  cin >> a >> b;
  cout << (a+b)%24<<endl;
}


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

typedef complex<int> point;
typedef long long int lli;
typedef long double ld;
#define pii pair<int,int>
#define lasB(b) (b&(-b))
#define pld pair<ld,ld>
#define mod 1000000007
#define PI acos(-1.0)
#define PB push_back
#define N   1000006
#define EPS (1e-8)
#define ss substr
#define S second
#define IM image
#define F first
#define RE real
#define B begin
#define E end

lli n,m,x[102],y[102],z[102],ind;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i]>>z[i];
        if(z[i]!=0)ind=i;
    }
    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
        {
            int H=z[ind]+abs(x[ind]-i) + abs(y[ind]-j);
            bool all=1;
            for(int k=0;k<n;k++)
            {
                if(z[k]!= max( H-  abs(x[k]-i) - abs(y[k]-j) ,0LL) )
                {
                    all=0;
                    break;
                }
            }
            if(all)
                return cout<<i<<" "<<j<<" "<<H,0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

    int ans = 0, prev = 0;
    for (int i = 0; i < n; ++i) {
        int h;
        std::cin >> h;
        ans += std::max(0, h - prev);
        prev = h;
    }

    std::cout << ans << std::endl;
    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end() 
#define DESC(vec) vec.rbegin(), vec.rend()
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i]; 
#define ANS(s) cout << s << endl;
#define inc(a, b) cin >> a >> b;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n,m;
	long long int kotae = 0;
	cin>>n>>m;

	priority_queue<int> tamesi;

	rep(i,n){
			int mosi;
			cin>>mosi;
			tamesi.push(mosi);
	}

	rep(i,m){
		int kon;
		kon = tamesi.top();	
		tamesi.pop();
		tamesi.push(kon/2);
	}

	rep(i,n){
		kotae += tamesi.top();
		tamesi.pop();
	}

	cout<<kotae<<endl;
	return 0;
}


Measured memory_bytes: 3868
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int a[500000], n;
long long ans = 0;

int F[1000000];
int La[1000000];

int GF(int l, int r, int L, int R, int V)
{
    if (l <= L && R <= r)
        return F[V];
    if (r <= L || R <= l)
        return n;
    int M = (L + R) / 2;
    return min(GF(l, r, L, M, 2 * V + 1), GF(l, r, M, R, 2 * V + 2));
}

int GL(int l, int r, int L, int R, int V)
{
    if (l <= L && R <= r)
        return La[V];
    if (r <= L || R <= l)
        return -1;
    int M = (L + R) / 2;
    return max(GL(l, r, L, M, 2 * V + 1), GL(l, r, M, R, 2 * V + 2));
}

void Set(int p, int L, int R, int V)
{
    if (p + 1 <= L || R <= p)
        return;
    if (L <= p && p + 1 <= R)
    {
        F[V] = min(F[V], p);
        La[V] = max(La[V], p);
    }
    if (L + 1 == R)
        return;
    int M = (L + R) / 2;
    Set(p, L, M, 2 * V + 1);
    Set(p, M, R, 2 * V + 2);
}

int pos[500000];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    fill(F, F + 4 * n, n);
    fill(La, La + 4 * n, -1);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        pos[a[i]] = i;
    }
    for (int x = n; x >= 1; x--)
    {
        Set(pos[x], 0, n, 0);
        vector<int> nxt = {pos[x]};
        for (int i = 0; i < 2; i++)
        {
            if (nxt[nxt.size() - 1] == 1000000) break;
            nxt.push_back(GF(nxt[nxt.size() - 1] + 1, n, 0, n, 0));
        }
        vector<int> pre = {pos[x]};
        for (int i = 0; i < 2; i++)
        {
            if (pre[pre.size() - 1] == -1) break;
            pre.push_back(GL(0, pre[pre.size() - 1], 0, n, 0));
        }
        if (nxt.size() >= 3 && pre.size() >= 2)
            ans += 1LL * (nxt[2] - nxt[1]) * (pre[0] - pre[1]) * x;
        if (nxt.size() >= 2 && pre.size() >= 3)
            ans += 1LL * (nxt[1] - nxt[0]) * (pre[1] - pre[2]) * x;
    }
    cout << ans;
}


Measured memory_bytes: 8960
#include<bits/stdc++.h>
#define rep(i, a, b) for(int i=a; i<b; i++)
#define repi(i, a, b) for(int i=a; i>b; i--)
#define db(x) (cerr << #x << ": " << x << '\n')
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll, ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define fi first
#define se second
#define umap unordered_map
#define umapi umap<int, int>
#define mapi map<int, int>
#define uset unordered_set
#define useti uset<int>
#define seti set<int, int>
#define pqueue priority_queue
#define si(a) scanf("%d", &a)
#define sll(a) scanf("%lld", &a)
#define bitcount(x) __builtin_popcount(x)
#define PI acos(-1.0)
#define EPS 1e-9
#define mod 1000000007
#define MOD 1000000007
#define N 200000
#define int ll
using namespace std;

template<typename T>
using maxpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using minpq = priority_queue<T>;

#define B 20
vi ans[20];

main()
{	
	cerr << "I will return...\n";
	
	int n;
	cin >> n;
	
	int a[n];
	int oo = 0;
	for(int & i : a){
		cin >> i;
		
		rep(k, 0, B) {
			if ((i & (1 << k))){
				ans[k].pb(oo);
			}
		}
		oo++;
	}
	
	int anss = 0;
	
	rep(i, 0, B) {
		sort(all(ans[i]));
	}
//	db("hello");
	int mn = n;
	repi(i, n-1, -1){
		int j = n;
		
		rep(l, 0, B){
			if(!(a[i] & (1 << l))) {
				continue;
			}
			int k = (upper_bound(all(ans[l]), i)) - ans[l].begin();
			
			if(k < ans[l].size()) {
				j = min(j, ans[l][k]);
			}
		}
		mn = min(mn, j);
//		db(i), db(mn);
		anss += mn - i;
	}
	
	cout << anss << '\n';
	
	cerr << "...don't you ever hang your head.";
}








Measured memory_bytes: 17652
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[100000];
signed main(){
	int n,ans=0;
	cin>>n;
	f(i,n) cin>>x[i];
	f(i,n){
		if(x[x[i]-1]==i+1) ans++;
	}
	cout<<ans/2<<endl;
	return 0;
}


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

int main () {
    int H, W;
    cin >> H >> W;
    while (H > 0 || W > 0) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1)) {
                    printf("#");
                }
                else {
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
        cin >> H >> W;
    }
}


Measured memory_bytes: 3016
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <stdio.h>
using namespace std;

int n, m, ans = 1;
int h[30];

int main() {

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	m = h[0];

	for (int i = 1; i < n; i++) {
		if (m <= h[i]) {
			ans++;
			m = h[i];
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)


Measured memory_bytes: 2940
#if __cplusplus > 199711L      /* C++11 */
#include <unordered_map>
#include <unordered_set>
#include <forward_list>
#include <array>
#endif                         /* C++11 */
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <climits>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS cin.tie(0);ios::sync_with_stdio(false)
#define M_P make_pair
#define P_B push_back
#define U_B upper_bound
#define L_B lower_bound
#define P_Q priority_queue
#define FIR first
#define SEC second
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZ(x) ((int)(x).size())
#define COUT(x) cout<<(x)<<endl
#define CIN(x) cin>>(x)
#define CIN2(x,y) cin>>(x)>>(y)
#define CIN3(x,y,z) cin>>(x)>>(y)>>(z)
#define CIN4(x,y,z,w) cin>>(x)>>(y)>>(z)>>(w)
#define SCAND(x) scanf("%d",&(x))
#define SCAND2(x,y) scanf("%d%d",&(x),&(y))
#define SCAND3(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
#define SCAND4(x,y,z,w) scanf("%d%d%d%d",&(x),&(y),&(z),&(w))
#define SCANLLD(x) scanf("%lld",&(x))
#define SCANLLD2(x,y) scanf("%lld%lld",&(x),&(y))
#define SCANLLD3(x,y,z) scanf("%lld%lld%lld",&(x),&(y),&(z))
#define SCANLLD4(x,y,z,w) scanf("%lld%lld%lld%lld",&(x),&(y),&(z),&(w))
#define PRINTD(x) printf("%d\n",(x))
#define PRINTLLD(x) printf("%lld\n",(x))
typedef long long int lli;
using namespace std;

int ctoi(char c)
{
  if( c >= '0' and c <= '9' )
    {
      return (int)(c-'0');
    }

  return -1;
}

int alphabet_pos(char c) 
{
  if( c >= 'a' and c <= 'z' )
    {
      return (int)(c-'a');
    }

  return -1;
}


int alphabet_pos_capital(char c)
{
  if( c >= 'A' and c <= 'Z' )
    {
      return (int)(c-'A');
    }

  return -1;
}


vector<string> split(string str, char ch)
{
  int first = 0;
  int last = str.find_first_of(ch);
  
  if(last == string::npos)
    {
      last = SIZ(str);
    }

  vector<string> result;

  while( first < SIZ(str) )
    {
      string Ssubstr(str, first, last - first);
      result.push_back(Ssubstr);
      first = last + 1;
      last = str.find_first_of(ch, first);

      if(last == string::npos)
	{
	  last = SIZ(str);
	}
    }
  
  return result;
}

/*--------------- the end of the template --------------------*/









int main()
{
  //IOS; /* making cin faster */
  int A,B,C;
  SCAND3(A,B,C);

  if( (C-A)*(B-C) > 0 )
    {
      printf("Yes\n");
      
    }
  else
    {
      printf("No\n");
      
    }
  

}


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

// // 一つ目
// int main() {
//     int n;
//     cin >> n;
//     vector<string> s(n);
//     vector<int> p(n);
//     vector<int> ord(n);
//     for(int i=0; i<n; i++){
//         cin >> s[i] >> p[i];
//     }
//     // iotaは第三引数から始まる整数列を生成する
//     iota(ord.begin(), ord.end(), 0);

//     // lambda式を使用したsor -> lambda式の条件を満たすようにsortする
//     sort(ord.begin(), ord.end(), [&](int x, int y){
//         if(s[x]==s[y]){
//             return p[x] > p[y];
//         }
//         return s[x] < s[y];
//     });

//     for(auto e: ord){
//         cout << e+1 << endl;
//     }
//     return 0;
// }

int main() {
    int n;
    cin >> n;
    vector<pair<pair<string, int>, int> > sp(n);
    for(int i=0; i<n; i++){
        int p;
        cin >> sp[i].first.first >> p;
        p *= -1;
        sp[i].first.second = p;
        sp[i].second = i + 1;
    }
    // pairのsortはfirstの比較の後にsecondの比較が入る
    sort(sp.begin(), sp.end());
    for(int i=0; i<n; i++){
        cout << sp[i].second << endl;
    }
    return 0;
}

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

typedef long long ll;

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main()
{
    int N;
    int D;

    cin >> N >> D;

    cout << (N+2*D) / (2*D+1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000000LL;
const ll r197=1000000007;
typedef pair<ll,ll>P;
typedef pair<P,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}
ll dp[401][401]={};
int n;
ll a[403];
ll reg(int m,int s){
	if(dp[m][s]!=-1)return dp[m][s];
	if(m==s)return 0;
	ll res=INF;
	rep(i,m,s){
		res=min(res,a[s]-a[m-1]+reg(m,i)+reg(i+1,s));
	}
//	cout<<m<<" "<<s<<" "<<res<<endl;
	return dp[m][s]=res;
}

int main() {
	memset(dp,-1,sizeof(dp));
	cin>>n;
	a[0]=0;
	rep(i,1,n+1){
		cin>>a[i];
		a[i]+=a[i-1];
	}
	cout<<reg(1,n)<<endl;
	return 0;
}


Measured memory_bytes: 1536
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N,Q = MI()
S = LS2()
A = [0]*N

for i in range(1,N):
    if S[i-1] == 'A' and S[i] == 'C':
        A[i] = 1

from itertools import accumulate

A = list(accumulate(A))

for i in range(Q):
    l,r = MI()
    print(A[r-1]-A[l-1])


Measured memory_bytes: 84360
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int A,B,C;
    cin >> A>>B>>C;
    cout << max({ A,B,C }) * 9 + A + B + C;
}

Measured memory_bytes: 256
#sheet...紙全体、sheet[x][y]は(x, y)のインクの濃さ
sheet = [[0 for _ in range(10)] for _ in range(10)]

#小、中、大のインクの範囲
small_range = ((0, 0), (1, 0), (0, 1), (-1, 0), (0, -1))
middle_range = ((0, 0), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))
large_range = ((0, 0), (1, 0), (2, 0), (1, 1), (0, 1), (0, 2), (-1, 1), (-1, 0), (-2, 0), (-1, -1), (0, -1), (0, -2), (1, -1))

#範囲内か判定してインクを足す
def drop(x, y, drop_range):
  for dx, dy in drop_range:
    newx, newy = x + dx, y + dy
    if 0 <= newx <= 9 and 0 <= newy <= 9:
      sheet[newx][newy] += 1

while True:
  try:
    x, y, s = map(int, input().split(","))

    if s == 1:
      drop(x, y, small_range)
    elif s == 2:
      drop(x, y, middle_range)
    else:
      drop(x, y, large_range)

  except EOFError:
    break

#0の個数
zero_cnt = 0

#インクの最大値
max_ink = 0

for x in range(10):
  for y in range(10):
    ink = sheet[x][y]

    if ink == 0:
      zero_cnt += 1

    if max_ink < ink:
      max_ink = ink

print(zero_cnt)
print(max_ink)


Measured memory_bytes: 5608
N, L = map(int, input().split())
s = 0
A = L-1+N # 末尾
if L*A >=0 and L>0:
    s = sum(range(L+1, A+1))
    
elif L*A <= 0:
    s = sum(range(L, A+1))

else:  # 両方マイナス
    s = sum(range(L, A))
print(s)


Measured memory_bytes: 3060
#include <iostream>
//#include <iomanip>
#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <unordered_map>
//#include <string>
typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007

LL pow(LL a, LL b){
    LL ans=1;
    for(int i=0; i<b; i++){
        ans*=a;
    }
    return ans;
}

int main() {
    LL h;
    LL num=0;
    LL ans=0;
    cin >> h;
    while(h!=1){
        h/=2;
        num++;
    }
    num++;
    for(int i=0; i<num; i++){
        ans+=pow(2,i);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"-----------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

#define MAX 100005
int n,m,ans;
int t;
P p[MAX];

signed main(){
  cin>>n>>m;
  
  for(int i=0; i<m; i++){
    cin>>p[i].second>>p[i].first;
  }
  
  sort(p, p+m);
  ans=1;
  t=p[0].first;
  for(int i=1; i<m; i++){
    if(p[i].second>=t){
      ans++;
      t=p[i].first;
    }
  }
  cout<<ans<<en;
  RE;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
typedef long long ll;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    ll N, X, T;
    cin >> N >> X >> T;
    if(N%X) out(T*(N/X+1));
    else out(T*(N/X));
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    const int inf = 1e6;
    vector<int> d(n, inf);
    auto dfs = [&](int v) {
        stack<int> q;
        q.push(v);
        d[v] = 1;
        while (!q.empty()) {
            int v = q.top();
            q.pop();
            for (int w : g[v]) {
                if (d[w] == inf) {
                    d[w] = d[v] + 1;
                    q.push(w);
                }
            }
        }
    };
    dfs(0);
    int v = distance(d.begin(), max_element(d.begin(), d.end()));
    fill(d.begin(), d.end(), inf);
    dfs(v);
    int D = *max_element(d.begin(), d.end());
    vector<int> W{0, 1, 0};
    W.reserve(D + 1);
    for (int dd = 3; dd <= D; ++dd) {
        W.push_back(!(W[dd - 1] & W[dd - 2]));
    }
    cout << (W[D] ? "First" : "Second") << endl;
    return 0;
}


Measured memory_bytes: 13556
import java.util.Scanner;


public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean[] atari = new boolean[3];
		atari[0] = true;
		while(sc.hasNext()){
			String change = sc.next();
			String[] changeArray = change.split(",");
			int a = henkan(changeArray[0]);
			int b = henkan(changeArray[1]);
			boolean c = false;
			c = atari[a];
			atari[a] = atari[b];
			atari[b] = c;
		}
		for(int i=0;i<3;i++){
			if(atari[i]){
				switch (i) {
				case 0:
					System.out.println("A");
					break;
				case 1:
					System.out.println("B");
					break;
				case 2:
					System.out.println("C");
					break;
				}
				break;
			}
		}
	}
	public static int henkan(String a){
		if(a.equals("A")){
			return 0;
		}else if(a.equals("B")){
			return 1;
		}
		return 2;
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
int n,f[2][500005],ff[500005],f1,f2;
long long sum,sum1,sum2;
struct note{
	int x,id;
}a[1000005];
bool cmp(note x,note y){
	return x.x<y.x;
} 
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i+n].x);
		f[0][i]=a[i].x,f[1][i]=a[i+n].x;
		sum1+=a[i].x,sum2+=a[i+n].x; 
		a[i].id=i,a[i+n].id=i+n; 
	}
	std::sort(a+1,a+2*n+1,cmp);
	for (int i=1;i<=n;i++) sum=sum+a[i].x;
	for (int j=1;j<=n;j++) {
		int i=a[j].id;
		if (i>n){
			if (ff[i-n]){
				printf("%lld\n",sum);
				return 0;
			}
			ff[i-n]=1,f2=1;
		}
		else {
			if (ff[i]){
				printf("%lld\n",sum);
				return 0; 
			}
			ff[i]=1,f1=1;
		}
	}
	if(f1==0 || f2==0) {
		printf("%lld\n",sum);
		return 0;
	}
	int m=1000000000;
	for (int i=n+1;i<=2*n;i++){
		int j=a[i].id-1;
		if (j%n!=(a[n].id-1)%n) m=std::min(m,f[j/n][j%n+1]-a[n].x);
		else m=std::min(m,f[j/n][j%n+1]-a[n-1].x)	;
	}
	printf("%lld",std::min(sum+m,std::min(sum1,sum2))); 
} 

Measured memory_bytes: 7936
def smaller(x, y):
	if x < y:
		return x
	return y

N = int(input())
anscounter = []
for i in range(0, 26):
	anscounter.append(0)
S = input()
for i in range(0, len(S)):
	anscounter[ord(S[i])-97] += 1
for i in range(1, N):
	tmpcounter = []
	for j in range(0, 26):
		tmpcounter.append(0)
	newS = input()
	for j in range(0, len(newS)):
		tmpcounter[ord(newS[j])-97] += 1
	for j in range(0, 26):
		anscounter[j] = smaller(anscounter[j], tmpcounter[j])
ans = ''
for i in range(0, 26):
	for j in range(0, anscounter[i]):
		ans = ans + str(chr(i+97))
print(ans)

Measured memory_bytes: 41072
# -*- coding: utf-8 -*-
import sys
# スペース区切りの整数の入力
a, b = map(int, raw_input().split())
# 文字列の入力

if a < 6:
  result = b/2
  print 0
  sys.exit()

if 6 <= a and a <= 12 :
  result = b/2
  print result
  sys.exit()
result = b
print result


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	ll N,X;cin>>N>>X;
	vl x(N);
	rep(i,N)cin>>x[i];
	vl y(N);
	ll GCD=abs(x[0]-X);
	rep(i,N){
		y[i]=abs(x[i]-X);
		GCD=gcd(GCD,y[i]);
	}
	cout<<GCD<<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(){
    long N,W; cin>>N>>W;
    vector<vector<long>> obj(4);
    long bw,v; cin>>bw>>v;
    obj[0].push_back(v);
    REP(i,N-1){
        long w; cin>>w>>v;
        obj[w-bw].push_back(v);
    }
    REP(i,4){
        sort(begin(obj[i]),end(obj[i]),greater<long>());
        obj[i].insert(begin(obj[i]),0);
    }
    long f1=0,MAX=0;
    REP(i,obj[0].size()){
        f1+=obj[0][i];
        long f2=0;
        REP(j,obj[1].size()){
            f2+=obj[1][j];
            long f3=0;
            REP(k,obj[2].size()){
                f3+=obj[2][k];
                long f4=0;
                REP(l,obj[3].size()){
                    f4+=obj[3][l];
                    if((i*bw+j*(bw+1)+k*(bw+2)+l*(bw+3))>W)
                        break;
                    MAX=max(MAX,f1+f2+f3+f4);
                }
            }
        }   
    }
    cout<<MAX;
}

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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;

  if (A+B > C+D){
      cout << "Left" << endl;
  }else{
    if (A+B < C+D){
      cout << "Right" << endl;
    }else{
      cout << "Balanced" << endl;
    }
  }

}


Measured memory_bytes: 256
let n = Scanf.scanf " %d" (+) 0
let ps = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ps0 = Array.copy ps
let _ = Array.sort (-) ps0;
  if ps = ps0 then (print_endline "YES"; exit 0);
  for i = 0 to n - 1 do
    for j = i + 1 to n - 1 do
      let ps1 = Array.copy ps in
      ps1.(j) <- ps.(i); ps1.(i) <- ps.(j); if ps1 = ps0 then (print_endline "YES"; exit 0) done done;
  print_endline "NO"

Measured memory_bytes: 896
#include<cstdio>
#include<map>
#include<algorithm>
typedef long long LL;
std::map<LL,int>set;
char s[10+5];

int main(){
    int n;
    scanf("%d",&n);
    LL ans = 0;
    while(n--){
        scanf("%s",s);
        std::sort(s,s+10);
        LL cur = 0;
        for(int i = 0; i < 10; i++){
            cur *= 26;
            cur += s[i]-'a';
        }
        if(set.count(cur)){ 
            ans += (LL)set[cur];
            set[cur]++;
        }
        else set[cur] = 1;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 6528
#include<cstdio>
#include<algorithm>
#define int long long
using namespace std;
const int N=100100;
int n,m,x[N],v[N],v1[N],v2[N],tmp1[N],tmp2[N],ans;
int read() {
	int tmp=0; char c=getchar();
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') tmp=tmp*10+c-48,c=getchar();
	return tmp;
}
#undef int
int main() {
	n=read(); m=read();
	for (int i=1;i<=n;i++) x[i]=read(), v[i]=read();
	for (int i=1;i<=n;i++) v1[i]=v1[i-1]+v[i];
	for (int i=n;i>=1;i--) v2[i]=v2[i+1]+v[i];
	for (int i=1;i<=n;i++) ans=max(ans,v1[i]-x[i]);
	for (int i=n;i>=1;i--) ans=max(ans,v2[i]-m+x[i]);
	for (int i=1;i<=n;i++) tmp1[i]=max(tmp1[i-1],v1[i]-x[i]);
	for (int i=n;i>=1;i--) tmp2[i]=max(tmp2[i+1],v2[i]-(m-x[i])*2);
	for (int i=1;i<=n;i++) ans=max(ans,tmp1[i]+tmp2[i+1]);
	//printf("%lld %lld\n",tmp1,tmp2);
	//ans=max(ans,tmp1+tmp2); tmp1=tmp2=0;
	for (int i=1;i<=n;i++) tmp1[i]=max(tmp1[i-1],v1[i]-x[i]*2);
	for (int i=n;i>=1;i--) tmp2[i]=max(tmp2[i+1],v2[i]-(m-x[i]));
	for (int i=1;i<=n;i++) ans=max(ans,tmp1[i]+tmp2[i+1]);
	//printf("%lld %lld\n",tmp1,tmp2);
	//ans=max(ans,tmp1+tmp2);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4864
#0:black
#1:white
S=input()
N=len(S)
X=""
Y=""
for i in range(N):
    if i%2==0:
        X=X+"0"
        Y=Y+"1"
    else:
        X=X+"1"
        Y=Y+"0"
A=0
B=0
for i in range(N):
    if X[i]!=S[i]:
        A+=1
    if Y[i]!=S[i]:
        B+=1
print(min(A,B))

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;

#define ASC(a) a.begin(), a.end()		// 昇順ソート 例：sort(ASC(a));
#define DESC(a) a.rbegin(), a.rend()	// 降順ソート 例:sort(DESC(a));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(a) rep(i, n) cin>>a[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;
#define only_unique(vec) vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
#define souwa(vec) accumulate(ASC(vec), 0)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vii;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };


// ────────────────────────────────────────────────────

int main() {
	int b[3];
	rep(i, 3) cin >> b[i];

	if (b[0] == 1 && b[1] == 0 && b[2] == 0) cout << "Close" << endl;
	else if (b[0] == 0 && b[1] == 1 && b[2] == 0) cout << "Close" << endl;
	else if (b[0] == 1 && b[1] == 1 && b[2] == 0) cout << "Open" << endl;
	else if (b[0] == 0 && b[1] == 0 && b[2] == 1) cout << "Open" << endl;
	else cout << "Close" << endl;
}


Measured memory_bytes: 3088
from collections import deque
def getinputdata():

    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

x=arr_data[0][0]

b = deque([])

for v in x:
    
    if v=="S":
        
        b.appendleft(v)
        
    elif v=="T" and (len(b)==0 or b[0]=="T"):
        
        b.appendleft(v)
        
    else:
            
        b.popleft()
            
print(len(b))    


Measured memory_bytes: 5084
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char
import qualified Data.Set as S

main = do
  a <- getLine
  b <- getLine
  putStrLn $ judge a b

judge::String -> String -> String
judge a b
  | length a > length b = "GREATER"
  | length a < length b = "LESS"
  | a > b = "GREATER"
  | a < b = "LESS"
  | otherwise = "EQUAL"



Measured memory_bytes: 380
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		int n = sc.nextInt();

		long ans = 0;
		for (int i = 0; r * i <= n; i++) {
			for (int j = 0; r * i + g * j <= n; j++) {
				if ((n - r * i - g * j) % b == 0) {
					ans++;
				}
			}
		}
		
		pr.println(ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23764
H, W = map(int, input().split())
X = [input() for _ in range(H)]

grid0 = [[0] * (W + 1) for _ in range(H + 1)]

# L -> R
for i in range(H):
    for j in range(W):
        if X[i][j] == ".":
            grid0[i + 1][j + 1] = grid0[i + 1][j] + 1
        
# L <- R
for i in range(H):
    for j in reversed(range(W)):
        if grid0[i + 1][j] > 0:
            grid0[i + 1][j] = max(grid0[i + 1][j], grid0[i + 1][j + 1])

grid1 = [[0] * (W + 1) for _ in range(H + 1)]
for i in range(H):
    for j in range(W):
        if X[i][j] == ".":
            grid1[i + 1][j + 1] = grid1[i][j + 1] + 1

for i in reversed(range(H)):
    for j in range(W):
        if grid1[i][j + 1] > 0:
            grid1[i][j + 1] = max(grid1[i][j + 1], grid1[i + 1][j + 1])

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, grid0[i + 1][j + 1] + grid1[i + 1][j + 1] - 1)
print(ans)


Measured memory_bytes: 142908
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <string>
#include <cmath>
#define SIZE 205
#define INF 1000000005
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

vector <int> vx;
int H[SIZE];
ll dp[2][SIZE];
ll all[SIZE];

ll mpow(ll m,ll t)
{
	if(t==0) return 1LL;
	ll ret=mpow(m,t/2);
	ret=ret*ret%MOD;
	if(t%2==1) ret=ret*m%MOD;
	return ret;
}
int main()
{
	int n;
	scanf("%d",&n);
	vx.push_back(INF);
	vx.push_back(1);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&H[i]);
		vx.push_back(H[i]);
	}
	sort(vx.begin(),vx.end());
	vx.erase(unique(vx.begin(),vx.end()),vx.end());
	int pos=0;
	for(int i=0;i+1<vx.size();i++)
	{
		int low=vx[i]+1,up=vx[i+1];
		up=min(up,H[0]);
		if(low>up) dp[pos][i]=0;
		else
		{
			dp[pos][i]=2LL*(mpow(2,up-low+1)-1LL)%MOD*mpow(2,H[0]-up)%MOD;
		}
	}
	all[0]=2LL;
	for(int i=1;i<n;i++)
	{
		pos^=1;
		memset(dp[pos],0,sizeof(dp[pos]));
		int t=lower_bound(vx.begin(),vx.end(),H[i])-vx.begin();
		for(int j=0;j+1<vx.size();j++)
		{
			if(dp[pos^1][j]==0) continue;
			if(j+1<=t)
			{
				ll vl=dp[pos^1][j];
				if(H[i-1]<H[i]) vl=vl*mpow(2,H[i]-H[i-1])%MOD;
				dp[pos][j]+=vl;
				if(dp[pos][j]>=MOD) dp[pos][j]-=MOD;
			}
			else
			{
				all[i]+=dp[pos^1][j]*2LL%MOD;
				if(all[i]>=MOD) all[i]-=MOD;
			}
		}
		if(all[i-1]!=0)
		{
			for(int j=0;j+1<vx.size();j++)
			{
				int low=vx[j]+1,up=vx[j+1];
				low=max(low,H[i-1]+1);
				up=min(up,H[i]);
				if(low<=up)
				{
					dp[pos][j]+=all[i-1]*2LL%MOD*(mpow(2,up-low+1)-1LL)%MOD*mpow(2,H[i]-up)%MOD;
					if(dp[pos][j]>=MOD) dp[pos][j]-=MOD;
				}
			}
			all[i]+=all[i-1]*2LL%MOD;
			if(all[i]>=MOD) all[i]-=MOD;
		}
	}
	ll ret=all[n-1];
	for(int i=0;i+1<vx.size();i++)
	{
		ret+=dp[pos][i];
		if(ret>=MOD) ret-=MOD;
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 256
//   https://atcoder.jp/contests/abc048/tasks/abc048_a


#include<stdio.h>            //AA06( 31/ 07/ 20) If u see my code, Have a Good Day! (^_^)
#define String_Length 101

int main()
{
    char A[String_Length], B[String_Length], C[String_Length];

    scanf("%s%s%s", A, B, C);

    printf("%c%c%c\n", A[0], B[0], C[0]);

    return 0;
}



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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll a,v;cin >>a>>v;
    ll b,w;cin >>b>>w;
    ll t;cin >>t;
    ll d=v-w;
    bool flg=false;
    if(d>0){
        if(abs(a-b)<=t*d)flg=true;
    }
    if(flg)puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
using namespace std;
typedef long long ll;
const ll inf = 0x3f3f3f3f3f3f3f;
const int maxn = 100010;
vector<int> p[maxn];
priority_queue<int> q;
int main(void)
{
    int n,m;
    int a,b;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a,&b);
        p[a].push_back(b);
    }
    int ans = 0;
    for(int i=1;i<maxn;i++) sort(p[i].begin(),p[i].end());
    for(int i=1;i<=m;i++){
        for(int j=0;j<p[i].size();j++){
            q.push(p[i][j]);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    printf("%d\n",ans);
    return 0;
}


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

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X, Y;
    cin >> X >> Y;
    if (abs(X - Y) <= 1) {
        cout << "Brown" << endl;
    } else {
        cout << "Alice" << endl;
    }
    return 0;
}


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

using namespace std;

int main(void) {
  int N, H, W;
  cin >> N >> H >> W;
  cout << (N + 1 - H) * (N + 1 - W) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string n; cin >> n;
  uint64_t s = 0ULL;
  for (char d : n) 
    s += static_cast<int>(d - '0');
  cout << (s % 9ULL ? "No" : "Yes") << endl;
  return 0;
}

Measured memory_bytes: 3748
{-# LANGUAGE ScopedTypeVariables #-}

import Data.Array.IO
import Data.Array
import Control.Monad
import Control.Applicative

bfs :: IOUArray (Int, Int) Char -> IOUArray (Int, Int) Int -> (Int, Int) -> [(Int, Int)] -> IO Int
bfs grid distance goal [] = return (-1)
bfs grid distance goal (p@(y,x):queue) = do
  ((miny,minx),(maxy,maxx)) <- getBounds grid
  d <- readArray distance p
  if p == goal then
    return d
  else do
    next <- filterM (\(ny,nx) ->
              if (ny < miny || nx < minx || ny > maxy || nx > maxx) then
                return False
              else do
                ng <- readArray grid (ny,nx)
                nd <- readArray distance (ny,nx)
                return (nd == -1 && ng /= '#')
            ) [(y+1,x),(y-1,x),(y,x+1),(y,x-1)]
    forM_ next $ \n -> writeArray distance n (d+1)
    bfs grid distance goal (queue ++ next)

main = do
  [h,w] <- map read . words <$> getLine :: IO [Int]
  strs <- replicateM h getLine :: IO [String]
  (grid :: IOUArray (Int, Int) Char) <- thaw $ listArray ((1,1),(h,w)) $ concat strs
  (distance :: IOUArray (Int, Int) Int) <- newArray ((1,1),(h,w)) (-1)
  (grid' :: Array (Int, Int) Char) <- freeze grid
  let white = (h*w) - 2 - (length [() | (_,e) <- assocs grid', e == '#'])
  b <- bfs grid distance (h,w) [(1,1)]
  print $ if b == -1 then b else white - b

Measured memory_bytes: 1148
#include<bits/stdc++.h>
using namespace std;
int main(){
	int i=4;
	char c[10];
	cin>>c;
	while(--i){
		if(c[i-1]=='7'){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a%b == 0) {
			System.out.println(0);
		}else {
			System.out.println(1);
		}
	}
}


Measured memory_bytes: 23636
def divisor(n):
  ass=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ass.append(i)
      if i!=n//i:ass.append(n//i)
  return ass
n=int(input())
ans=len(divisor(n-1))-1
for i in divisor(n):
  if i==1:continue
  m=n
  while m%i==0:m//=i
  if m%i==1:ans+=1
print(ans)


Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }

    int nBreak = 0;
    bool flag = false;
    int target = 1;
    for (int i = 0; i < N; ++i) {
        if (a[i] == target) {
            flag = true;
            target++;
        }
        else {
            nBreak++;
        }
    }
    if (!flag) {
        nBreak = -1;
    }
    cout << nBreak;

    return 0;
}

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

#define mod 1000000007
#define maxn 100005

int a, b;

int main()
{
    //freopen("monotonic.in", "r", stdin);
    //freopen("monotonic.out", "w", stdout);
    cin >> a >> b;
    if (a >= 10 || b >= 10)
        printf("-1\n");
    else
        printf("%d\n", a * b);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.nextLine();
        String t = sc.nextLine();
        
        int[][] lcs = new int[3030][3030];
        
        if(s.length() < t.length()){
            String tmp = s;
            s = t;
            t = tmp;
        }
        
        int slen = s.length();
        int tlen = t.length();
        for(int i=1; i<=slen; i++){
            for(int j=1; j<=tlen; j++){
                if(s.charAt(i-1)==t.charAt(j-1)){
                    lcs[i][j] = lcs[i-1][j-1]+1;
                }else{
                    lcs[i][j] = Math.max(lcs[i][j-1], lcs[i-1][j]);
                }
            }
        }
        
        printLcs(s,t,lcs,slen,tlen);
        System.out.println("");
    }
    
    public static void printLcs(String s, String t, int[][] lcs, int i, int j){
        if(i==0 || j==0){
            return;
        }
        
        if(s.charAt(i-1) == t.charAt(j-1)){
            printLcs(s,t,lcs,i-1,j-1);
            System.out.print(s.charAt(i-1));
        }else{
            if(lcs[i-1][j] >= lcs[i][j-1]){
                printLcs(s,t,lcs,i-1,j);
            }else{
                printLcs(s,t,lcs,i,j-1);
            }
        }
        
    }
}


Measured memory_bytes: 82500
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)

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

int main(void)
{
	int n, q;
	while (cin >> n >> q, n|q) {
		vector<int> vs;
		rep(i, n) {
			int m;
			cin >> m;
			rep(j, m) {
				int t; cin >> t;
				vs.push_back(t);	
			}
		}

		vector<pii> ans;
		rep(i, vs.size()) {
			int n = vs[i];
			int cnt = 0;
			REP(j, i, vs.size())
				if (vs[j] == n)
					cnt++;
			ans.push_back(pii(cnt, n));
		}

		rep(i, ans.size())
			REP(j, i+1, ans.size())
				if (ans[i].first < ans[j].first)
					swap(ans[i], ans[j]);
		rep(i, ans.size())
			REP(j, i+1, ans.size())
				if (ans[i].first == ans[j].first &&
					ans[i].second > ans[j].second)
					swap(ans[i], ans[j]);

		if (ans.size() == 0 || ans[0].first < q)
			cout << 0 << endl;
		else
			cout << ans[0].second << endl;
	}
	return 0;
}

Measured memory_bytes: 1256
# from sys import exit, stderr
# from inspect import currentframe
# def debug(*args):
#     names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
#     print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args), file=stderr)
#     return
N = int(input())
a = [0 for _ in range(N)]
for i in range(N):
    a[i] = (i,int(input()))
a = sorted(a, key=lambda x: -x[1])
for i in range(N):
    for j in range(N):
        if a[j][0] == i:
            continue
        print(a[j][1])
        break


Measured memory_bytes: 76364
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{   
        ll n;
        ll w;
        cin>>n>>w;
        vector<vector<ll>> dp(n+1, vector<ll>(w+1,0));
        vector<ll> wiegths(n+1);
        vector<ll> value(n+1);
        for(int i = 0 ; i < n ; i++)
        {
            cin>>wiegths[i+1];
            cin>>value[i+1];
        }
        for(int i = 1 ; i <=n ; i++)
        {
            for(int j = 1 ; j <= w ;j++)
            {   
                dp[i][j] = max(dp[i][j] , dp[i-1][j]);
                if(j >= wiegths[i] )
                {
                    dp[i][j] = max(dp[i][j] , value[i] + dp[i-1][j - wiegths[i]]);
                }
            }
        }
        cout<<dp[n][w]<<endl;
        
}

Measured memory_bytes: 80256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  string ans = "No";
  
  if ( a + b == c){
    ans = "Yes";
  }
  
  if( a + c == b){
    ans = "Yes";
  }
  
  if ( a == b+ c){
    ans = "Yes";
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int K; cin>>K;
  int even = 0, odd = 0;
  if(K % 2 == 0) {
    even = odd = K / 2;
  } else {
    even = K / 2;
    odd = even + 1;
  }
  cout << even * odd << endl;
}


Measured memory_bytes: 256