akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>

#define ll long long
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug(Head head,Tail... tail){
    cerr<<" "<<to_string(head);
    debug(tail...);
}

int main(){
    int N;
    cin>>N;
    string S;
    cin>>S;
    int list[26]={};
    FOR(i,S.size()){
        list[S[i]-'a']++;
    }
    ll sm=0;
    FOR(i,26){
        if(list[i]>0)sm=(sm+list[i]*sm+list[i])%1000000007;
    }
    cout<<sm<<endl;
    return 0;
}

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

using namespace std;

int main(void) {
  int N; cin >> N;
  
  if ((N/10)%111 == 0 || (N%1000)%111 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int maxn = 100;
char s[2][maxn];
ll f(int n)
{
	if(n == 1) return 3;
	if(n == 2 && s[0][1] == s[0][2]) return 6;
	if(s[0][n] == s[1][n])
	{
		if(s[0][n - 1] == s[1][n - 1]) return 2 * f(n - 1) % mod;
		else return f(n - 1);
	}
	else
	{
		if(s[0][n - 2] == s[1][n - 2]) return 2 * f(n - 2) % mod;
		else return 3 * f(n - 2) % mod;
	}
}
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 0; i < 2; ++i) scanf("%s", s[i] + 1); 
	cout << f(n) << endl;
	return 0;
}

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

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if((a+b+c)>= 22){
        cout << "bust" << endl;
    }
        
    else{
        cout << "win" << endl;
    }    



    return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}


int X[55], Y[55];

int main2() {
  int N, K; cin >> N >> K;
  REP(i, N) {
    cin >> X[i] >> Y[i];
  }
  ll ans = 1LL << 62;
  REP(i2, N) REP(i1, i2) 
  REP(j2, N) REP(j1, j2) 
  {
    ll x1 = min(X[i1], X[i2]);
    ll x2 = max(X[i1], X[i2]);
    ll y1 = min(Y[j1], Y[j2]);
    ll y2 = max(Y[j1], Y[j2]);
    int in = 0;
    REP(i, N) {
      if (x1 <= X[i] && X[i] <= x2 && y1 <= Y[i] && Y[i] <= y2) {
        in++;
      }
    }
    if (in >= K) chmin(ans, (x2-x1) * (y2-y1));
  }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll gcd(ll a, ll b);
ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);
#define N 100000

vector<int> parent(N);
vector<int> class_num(N, 1);

// union find
int find_root(int a){
  if (parent[a] == a)
    return a;

  parent[a] = find_root(parent[a]);
  return parent[a];
}

int main(void){
  ll n, m;
  cin >> n >> m;
  vector<pair<int, int>> edge(m);
  for (int i = 0; i < m; i++){
    int u, v;
    cin >> u >> v;
    u--; v--;
    edge[i].first = u;
    edge[i].second = v;
  }

  for (int i = 0; i < n; i++){
    parent[i] = i;
  }


  ll convenience = 0;
  vector<ll> hoge(m, 0);
  for (int i = m - 1; i > 0; i--){
    int u = edge[i].first, v = edge[i].second;
    if (find_root(u) == find_root(v)){
      ;
    }
    else {
      ll cv = class_num[find_root(v)];
      ll cu = class_num[find_root(u)];
      parent[find_root(u)] = v;
      class_num[find_root(v)] = cv + cu;
      convenience += (cv + cu) * (cv + cu - 1)/2 - cv*(cv - 1)/2 - cu*(cu - 1)/2;
    }
    hoge[i - 1] = convenience;
  }


  for (int i = 0; i < m; i++){
    cout << n*(n-1)/2 - hoge[i] << endl;
  }

  return 0;
}

ll gcd(ll a, ll b){
  if (a < b)
    return gcd(b, a);
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}

ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;
  if (n <= 0)
    return 0;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    ll n;
    cin >> n;

    ll p = 1;

    for(ll i = 1; i <= n; i++){
        p = (p * i) % MODN;
    }

    cout << p << endl;

    return 0;
}


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

int main(){
int a,b = 0;

cin >> a >> b;

if(a < b){
cout << "a < b" << endl;
}else if(a > b){
cout << "a > b" << endl;
}else {
cout << "a == b" << endl;
}

return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<vector>
#define MAX 200000
using namespace std;
typedef long long ll;
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  return (ret);
}
int main(){
  int n,m=0;
  cin >> n;
  vector<int> a(n);
  ll n_list[MAX+2]={};
  bool add[MAX+2]={};
  bool can=true;
  ll num=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=n;i>0;i--){
    if(n_list[i]%2!=a[i-1]){
      m++;
      add[i]=true;
      vector<ll> div = divisor(i);
      for(int j=0;j<div.size();j++){
        n_list[div[j]]++;
      }
    }
  }
  cout << m <<endl;
  for(int i=1;i<=n;i++){
    if(add[i])cout << i <<" ";
  }
  if(m!=0) cout << endl;
}


Measured memory_bytes: 3584
n = int(input())
mod = 10**9 + 7
C = [[0 for j in range(n + 1)] for i in range(n + 1)]
for i in range(n + 1):
    C[i][0] = 1
for i in range(1, n + 1):
    for j in range(1, n + 1):
        C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod
ans = 0
k = 1
while 3 * k <= n:
    ans += C[n - 2 * k - 1][k - 1]
    ans %= mod
    k += 1
print(ans)


Measured memory_bytes: 104724
#include <iostream>
#include <math.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
#define max_n 100
#define INF 100000000

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b+c){
        cout<<"Yes"<<endl;
    }else if(a+b==c){
        cout<<"Yes"<<endl;
    }else if(a+c==b){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 764
/*
 *  * main.cpp
 *   *
 *    */

#include<bits/stdc++.h>

using namespace std;

int main() {
    int res = 0;
    int n, k;
    scanf("%d%d", &n, &k);
    while (n > 0) n /= k, res++;

    printf("%d\n", res);
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  int n;
  while(cin >>n,n!=-1){
    double x=0,y=0,xp=0,yp=-1;
    for(int i=0; i<n; i++){
      x+=-yp/sqrt(xp*xp+yp*yp);
      y+=xp/sqrt(xp*xp+yp*yp);;
      xp = x;
      yp = y;
    }
    printf("%.2lf\n%.2lf\n",x,y);
  }
  return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <unordered_map>
#include <array>
using namespace std;
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
	pair<long, long> dir(1,0);
	string s;

	long x = 0;
	long y = 0;
	long x_t, y_t;
	cin >> s;
	s += 'T';
	long N = s.length();
	cin >> x_t >> y_t;
	vector<int> a;
	vector<int> b;
	int temp=0;
	bool flag=true;
	for (int i = 0; i < N; i++) {
		if (s[i] == 'T') {
			if (flag) {
				a.push_back(temp);
				temp = 0;
			}
			else {
				b.push_back(temp);
				temp = 0;
			}
			flag = !flag;
		}
		else temp++;
	}
	x_t -= *a.begin();
	a.erase(a.begin());

	set<int> A;
	A.insert(x);
	for (auto i : a) {
		set<int>A_;
		for (auto j : A) {
			A_.insert(j + i);
			A_.insert(j - i);
		}
		A = A_;
	}
	set<int> B;
	B.insert(y);
	for (auto i : b) {
		set<int>B_;
		for (auto j : B) {
			B_.insert(j + i);
			B_.insert(j - i);
		}
		B = B_;
	}

	string ans = A.find(x_t)!=A.end()&&B.count(y_t)>0?
		"Yes" : "No";
	cout << ans;


	return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    int cnt[N+1] = {}; //cnt[i]は1とiを結ぶ辺が選ばれた回数
    rep(i, M){
        int a, b; cin >> a >> b;
        if(a > b) swap(a, b);
        if(a > 1) cnt[a]++;
        cnt[b]++;
    }
    bool ok = true;
    rep(i, N+1) if(cnt[i]%2) ok = false;
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#define N 10001

int a[N], b[N];

int main() 
{
    int n, i;
    long long x = 0, y = 0;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
    	scanf("%d", a + i);
	}
	for(i = 0; i < n; i++){
    	scanf("%d", b + i);
	}
	 
	for(i = 0; i < n; i++){
		if(a[i] > b[i]) x += a[i] - b[i];
		else y += (b[i] - a[i]) >> 1;
	}
    if(x <= y) puts("Yes");
    else puts("No");
    
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

int main() {
	vector<int>nums(360);
	int N;cin>>N;
	for (int i = 0; i < N; ++i) {
		int m,d,v,s;cin>>m>>d>>v>>s;
		m--;d--;
		const int start=m*30+d;
		const int end=(start+v-1)%360;
		if (end > start) {
			for (int j = 0; j < 360; ++j) {
				if (start <= j&&j <= end) {
					nums[j]=max(nums[j],s);
				}
				else {
					if (j < start) {
						int l=min(start-j,j+360-end);
						nums[j]=(max(nums[j],s-l));
					}
					else {
						int l=min(j-end,start+360-j);
						nums[j]=(max(nums[j],s-l));
					}
				}
			}
		}
		else {
			for (int j = 0; j < 360; ++j) {
				if (end < j&&j < start) {
					nums[j]=max(nums[j],s-min(start-j,j-end));
				}
				else {
					nums[j]=max(s,nums[j]);
				}
			}
		}
	}
	auto it=min_element(nums.begin(),nums.end());
	cout<<*it<<endl;
	return 0;
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

void solve() {
  int n;
  cin >> n;
  int sum = 0;
  set<int> s;
  for (int i = 1; sum < n; i++) {
    sum += i;
    s.insert(i);
  }
  sum -= n;
  if (sum) {
    for (int i = 1; i <= sum; i <<= 1) {
      if (i & sum) s.erase(i);
    }
  }
  for (auto &i : s) cout << i << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}


Measured memory_bytes: 3868
ans=0
while 1:
    try:
        n=raw_input()
        tmp=''
        for i in n:
            if i.isdigit():
                tmp+=i
            elif len(tmp):
                ans+=int(tmp)
                tmp=''
        if len(tmp):
            ans+=int(tmp)
            tmp=''
    except:
        break
print ans

Measured memory_bytes: 6324
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    bool ans = false;
    rep(i, n + 1) {
        rep(j, m + 1) {
            if(i * (m - j) + j * (n - i) == k) {
                ans = true;
                break;
            }
        }
    }

    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define MOD 1000000007
using namespace std;
typedef long long int ll;

int main()
{
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll p[n]={0};
    p[n-1]=a[n-1];
    for(ll i=n-2;i>0;i--)
    {
        p[i]=p[i+1]+a[i];
    }
    ll sum=0;
    for(ll i=0;i<n-1;i++)
    {
       sum+=((a[i]%MOD)*(p[i+1]%MOD))%MOD;
    }
    cout<<sum%MOD<<"\n";
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	string s, t;
	cin >> s >> t;

	if (s == t.substr(0, t.size() - 1))
	{
		cout << "Yes" << endl;
	}
	else 
	{
		cout << "No" << endl;
	}
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3652
// CODE by Kazhybay Askar

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC    optimize("Ofast")
//#pragma GCC    target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define iter   set<int>::iterator
#define f      first
#define s      second
#define pb     push_back
#define pf     push_front
#define ppb    pop_back
#define ppf    pop_front
#define mp     make_pair
#define cont   continue
#define Speed  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz     size()
#define all(x) x.begin(),x.end()
#define cont   continue
#define r0     return 0
#define endl   '\n'

typedef long long ll;
typedef long double   ld;
typedef pair<ll,ll>   pll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;

const int MAXN  = 5e5  + 7;
const int MOD   = 1e9  + 7;
const int INF   = 1e9  + 7;
const ll  MINF  = 1e18 + 7;
const int EPS   = 1e-6;
const int dx[]  = {0, 0, 1, -1, -1, -1, 1, 1};
const int dy[]  = {1, -1, 0, 0, -1, 1, -1, 1};
const double pi = acos(-1.0);

void freopen(){
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}

ll n,m,a[MAXN];


void solve(){
    cin>>n;
    cin>>m;
    for(int i=1;i<=m;i++){
        ll l,r;
        cin>>l>>r;
        a[l]++;
        a[r+1]--;
    }
    ll cnt=0;
    for(int i=1;i<=n;i++){
        a[i]+=a[i-1];
        if(a[i]==m)cnt++;
    }
    cout<<cnt;
}

int main(){
    Speed;
    ll T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    r0;
}




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

string s;
ll x, y;
bool X[20000], Y[20000];
queue<ll> que;

signed main(){
    string s;
    ll x, y;
    cin >> s >> x >> y;
    ll f = 0, t = 0;
    X[0 + 10000] = true;
    Y[0 + 10000] = true;
    REP(i, s.length() + 1){
        if(i == s.length() || s[i] == 'T'){
            if(t % 2 == 0 && f > 0){
                for(ll j = -8000; j <= 8000; j++){
                    if(X[j + 10000]) que.push(j);
                    X[j + 10000] = false;
                }
                while(!que.empty()){
                    ll j = que.front();
                    que.pop();
                    if(t > 0) X[j - f + 10000] = true;
                    X[j + f + 10000] = true;
                }
            }else if(f > 0){
                for(ll j = -8000; j <= 8000; j++){
                    if(Y[j + 10000]) que.push(j);
                    Y[j + 10000] = false;
                }
                while(!que.empty()){
                    ll j = que.front();
                    que.pop();
                    Y[j - f + 10000] = true;
                    Y[j + f + 10000] = true;
                }
            }
            f = 0;
            t++;
        }else{
            f++;
        }
    }
    if(X[x + 10000] && Y[y + 10000]) PRINT("Yes");
    else PRINT("No");
    return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl
typedef long long ll;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;

using namespace std;

int main(){
    int x;  cin >> x;
    int ans = 1;
    for(int i=1; i<1001; i++){
        for(int j=2; j<15; j++){
            int tmp = pow(i,j);
            if(tmp > x)    break;
            if(tmp <= x)   ans = max(ans,tmp);
        }
    }
    print(ans);
}

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

/*bool subseq(string s,string t){
    ll y=0;
    for(ll i=0;y<s.size()&& i<t.size();i++){
        if(s[y]==t[i]){
            y++;
        }
    }
        if(y==s.size())
            return true;
        else  return false;
}*/
/*ll x=1000000001;
vector<bool>p(x,false);
void prime(){
    p[2]=true;
    for(ll i=3;i<x;i=i+2)
        p[i]=true;
    for(ll i=0;i<x;i=i+2){
        if(p[i]){
            for(ll j=i*i;j<x;j=j+i)
                p[j]=false;
        }
    }
}*/
/*vector<ll> divisor(ll n){
    vector<ll> d;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i==0){
        d.push_back(i);
        d.push_back(n/i);
        }
    }
    sort(d.begin(),d.end(),greater<ll>());
    return d;
}*/
/*bool bs(ll n,string s){
    ll a[4]={0};
    for(ll i=0;i<n-1;i++){
        a[s[i]-'0']++;
    }
    for(ll i=n-1;i<s.size();i++){
        a[s[i]-'0']++;
        if(a[1]>0 && a[2]>0 && a[3]>0)
        return true;
        a[s[i-n+1]-'0']--;
    }
    return false;
}*/


/*ll binarySearch(ll n,ll a[],ll x){
    ll low=0,high=n-1,mid,ans=-1;
    while(low<=high){
        mid=low+(high-low)/2;
        if(a[mid]>=x){

            high=mid-1;
        }
        else{
                ans=mid;
            low=mid+1;
        }
    }
    return a[ans];
}*/




/*bool subseq(string s,string t){
    ll y=0;
    for(ll i=0;y<s.size()&& i<t.size();i++){
        if(s[y]==t[i]){
            y++;
        }
    }
        if(y==s.size())
            return true;
        else  return false;
}*/
/*ll x=1000000001;
vector<bool>p(x,false);
void prime(){
    p[2]=true;
    for(ll i=3;i<x;i=i+2)
        p[i]=true;
    for(ll i=0;i<x;i=i+2){
        if(p[i]){
            for(ll j=i*i;j<x;j=j+i)
                p[j]=false;
        }
    }
}*/
/*vector<ll> divisor(ll n){
    vector<ll> d;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i==0){
        d.push_back(i);
        d.push_back(n/i);
        }
    }
    sort(d.begin(),d.end(),greater<ll>());
    return d;
}*/
/*bool bs(ll n,string s){
    ll a[4]={0};
    for(ll i=0;i<n-1;i++){
        a[s[i]-'0']++;
    }
    for(ll i=n-1;i<s.size();i++){
        a[s[i]-'0']++;
        if(a[1]>0 && a[2]>0 && a[3]>0)
        return true;
        a[s[i-n+1]-'0']--;
    }
    return false;
}*/


/*ll binarySearch(ll n,ll a[],ll x){
    ll low=0,high=n-1,mid,ans=-1;
    while(low<=high){
        mid=low+(high-low)/2;
        if(a[mid]>=x){

            high=mid-1;
        }
        else{
                ans=mid;
            low=mid+1;
        }
    }
    return a[ans];
}*/

void solve(vector<ll>a,ll n){

}
int main() {
    ll a[5];
    for(ll i=0;i<5;i++)
        cin>>a[i];
    for(ll i=0;i<5;i++)
        if(a[i]==0)
        cout<<i+1;


}





Measured memory_bytes: 3640
def resolve():
    n, x, m = map(int, input().split())
    a = [None] * m
    s = [x]
    a[x] = 0
    ans = x
    for i in range(1, n):
        x = pow(x, 2, m)
        if a[x] is None:
            ans += x
            a[x] = i
            s.append(ans)
        else:
            past = a[x]
            d = i - past
            ans += x
            s.append(ans)
            diff = s[i] - s[past]
            ans += ((n - i - 1) // d) * diff
            ans += s[past + ((n - i - 1) % d)] - s[past]
            break
    print(ans)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 68720
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

X,Y = inpl_s()
if X > Y:
	print('>')
elif X == Y:
	print('=')
else:
	print('<')


Measured memory_bytes: 4212
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
ll factrial(ll n)
{
    ll r = 1;
    repi(i, n + 1, 2)
    {
        r *= i;
        r %= MOD;
    }
    return r % MOD;
}
int main()
{
    int n, m;
    cin >> n >> m;
    if (abs(n - m) > 1)
    {
        cout << 0 << endl;
    }
    else if (abs(n - m) == 1)
    {
        cout << factrial(n) * factrial(m) % MOD << endl;
    }
    else
    {
        cout << factrial(n) * factrial(m) * 2 % MOD << endl;
    }
    return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
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);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
int main() {
  ll n;cin>>n;
  ll ans=n;
  if(n%2!=0){
    ans*=2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

const int mod = 1e9 + 7;
struct mint {
	ll x;
	mint(ll x = 0) :x(x% mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod)x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod)x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a)const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a)const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

mint dp0[2005][2005];
mint dp1[2005][2005];

int main() {
	int n, m; cin >> n >> m;
	vector<int>s(n+1), t(m+1);
	for (int i = 0; i < n; i++)scanf("%d", &s[i]);
	for (int i = 0; i < m; i++)scanf("%d", &t[i]);
	dp0[0][0] = 1;
	for (int i = 0; i < n + 1; i++)for (int j = 0; j < m + 1; j++) {
		dp0[i + 1][j] += dp0[i][j];
		dp1[i][j] += dp0[i][j];
		dp1[i][j+1] += dp1[i][j];
		if (s[i] == t[j]) {
			dp0[i + 1][j + 1] += dp1[i][j];
		}
	}
	cout << dp1[n][m].x << endl;
	return 0;
}

Measured memory_bytes: 63104
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n, l;
	cin >> n >> l;
	int s=(2*l+n)*(n-1)/2;
	if(l<0) s-=min(-l, n-1);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>

using namespace std;
typedef long long ll;

struct Infant
{
	ll x;
	ll A;
	bool operator<( const Infant& right ) const {
		return A > right.A; // 逆にしてソート
    }
};

ll DP[2000][2000];
int main()
{
	int N;
	ll A[2001];
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	
	Infant I[2001];
	for(int i = 0; i < N; i++){
		I[i].x = i;
		I[i].A = A[i];
	}
	sort(I, I+N);
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			DP[i][j] = 0;
		}
	}
	
	for(int i = 1; i <= N; i++){
		for(int x = 0; x <= i; x++){
			int y = i-x;
			DP[x][y] = max(x > 0 ? DP[x-1][y] +I[i-1].A * abs(I[i-1].x- (x-1)) : 0, y > 0 ? DP[x][y-1]+I[i-1].A * abs(I[i-1].x- (N-1-(y-1))) : 0);
		}
	}
	
	ll ans = 0;
	for(int x = 0; x <= N; x++){
		int y = N-x;
		if(ans < DP[x][y]){
			ans = DP[x][y];
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)2e5 + 9;
vector<int> idx[N];
int pi[N];
int gr[N];
int cnt[N];
int arr[N];
bool has[N];

int main(){
  fastIO;
  int n;
  ll k;
  cin >> n >> k;
  --k;
  int a;
  for(int i = 1; i <= n; i ++ ){
    cin >> a;
    arr[i] = a;
    idx[a].push_back(i);
    cnt[i] = -1;
  }
  for(int i = 1; i < N ; i ++ ){
    if(idx[i].empty()) continue;
    for(int j = 1; j < idx[i].size(); j ++ ){
      pi[idx[i][j-1]] = (idx[i][j] + 1 == n + 1 ? 1 : idx[i][j] + 1);
      gr[idx[i][j-1]] = ((idx[i][j] + 1) == n + 1);
    }
    gr[idx[i].back()] = (idx[i][0] + 1 == n + 1) + 1;
    pi[idx[i].back()] = (idx[i][0] + 1 == n + 1 ? 1 : idx[i][0] + 1);
  }
  int p = 1;
  cnt[1] = 0;
  while(cnt[pi[p]] == -1){
    cnt[pi[p]] = cnt[p] + gr[p];
    p = pi[p];
  }
  p = pi[p];
  vector<int> cyc;
  int node = p;
  if(k <= cnt[p]){
    while(k > 0){
      k -= gr[node];
      node = pi[node];
    }
  }
  else{
    k -= cnt[p];
    ll total = 0;
    do{
      cyc.push_back(p);
      total += gr[p];
      p = pi[p];
    }while(p != cyc[0]);
    k %= total;
    while(k > 0){
      k -= gr[node];
      node = pi[node];
    }
  }
  vector<int> res;
  for(int j = node; j <= n; j ++ ){
    if(!has[arr[j]]){
      res.push_back(arr[j]);
      has[arr[j]] = true;
    }
    else{
      while(has[arr[j]]){
        has[res.back()] = false;
        res.pop_back();
      }
    }
  }
  for(auto x : res)
    cout << x << " ";
  return 0;
}


Measured memory_bytes: 17016
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<bitset>
using namespace std;
int dy[]={-1,-1,0,0,1,1},dx[2][6]={{0,1,-1,1,0,1},{-1,0,-1,1,-1,0}};
int w,h;
vector<vector<int> >field;
bool f[100][100];
void dfs(int y,int x){
    if(x<0||x>=w||y<0||y>=h)return;
    if(field[y][x])return;
    if(f[y][x])return;
    f[y][x]=true;
    for(int i=0;i<6;i++)dfs(y+dy[i],x+dx[y&1][i]);
    return;
}
int main(){
    cin>>w>>h;
    field.resize(h,vector<int>(w));
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            cin>>field[i][j];
    for(int i=0;i<w;i++){
        dfs(0,i);dfs(h-1,i);
    }
    for(int i=0;i<h;i++){
        dfs(i,0);dfs(i,w-1);
    }
    int cnt=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(field[i][j]==0)continue;
            for(int k=0;k<6;k++){
                int y=i+dy[k],x=j+dx[i&1][k];
                if(y<0||y>=h||x<0||x>=w)cnt++;
                else if(f[y][x])cnt++;
            }
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 1576
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var Instance = new Question();
			Instance.Exec();
		}
	}

	public class Question
	{
		public void Exec()
		{
			long n = long.Parse(Console.ReadLine());
			Console.WriteLine((n * n * n).ToString());
			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 15964
N,K=map(int,input().split())
A=[bin(int(i))[2:][::-1] for i in input().split()]
K2=K&((1<<20)-1)
K1=K-K2
L=[0]*41
for a in A:
    for i in range(len(a)):
        if a[i]=='1':
            L[i]+=1
#print(L)
#print(K2,K1,K)
K1ans=0
otherans=0
for i in range(1<<20):
    t=0
    for j in range(20):
        if i & (1<<j):
            t+=(N-L[j])*(1<<j)
        else:
            t+=(L[j])*(1<<j)
    otherans=max(otherans,t)
    if i<=K2:
        K1ans=max(K1ans,t)
K1up=0
K1down=0
for i in range(1<<20):
    t=0
    if i>(K1>>20):
        continue
    for j in range(20):
        if i & (1<<j):
            t+=(N-L[j+20])*(1<<(j+20))
        else:
            t+=(L[j+20])*(1<<(j+20))
    if i<(K1>>20):
        K1down=max(K1down,t)
    else:
        K1up=max(K1up,t)
#print(K1up,K1down,K1ans,otherans)
if K1==0:
    print(K1up+K1ans)
else:
    print(max(K1up+K1ans,K1down+otherans))

Measured memory_bytes: 94312
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const double PI = acos(-1);
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll n;
  string s;
  cin >> n >> s;

  ll l = 0, r = 0;
  for(ll i = 0; i < n; i++){
    if(s[i] == '(') r++;
    else{
      if(r == 0) l++;
      else r--; 
    }
  }
  
  string t = "";
  for(ll i = 0; i < l; i++) t += '(';
  t += s;
  for(ll i = 0; i < r; i++) t += ')';
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
void call(int n) {
	int i = 1;
	bool flag = true;
	while (true) {
		flag = true;
		int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
			flag = false;
		}
		while (flag) {
			if (x % 10 == 3) {
				cout << " " << i;
				break;
			}
			x /= 10;
			if (x) {
			    continue;
			}else{
			    break;
			}
		}
		if (++i <= n) {
			continue;
		}
		else {
			break;
		}
	}
	cout << endl;
}
int main(){
    int n;
    cin>>n;
    call(n);
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1,mod=1e9+7;
const int inf=(1ull<<31)-1;
int x,y;

ll mpw(ll a,ll b){
	ll d=1;
	for (;b;d=d*a%mod,b--)
		for (;!(b&1);a=a*a%mod,b>>=1);
	return d;
}

ll C(ll m,ll n){
	ll a=1,b=1;
	for (int i=2;i<=n;i++)
		a=a*i%mod;
	for (int i=2;i<=m;i++)
		b=b*i%mod;
	for (int i=2;i<=n-m;i++)
		b=b*i%mod;
	return a*mpw(b,mod-2)%mod;
}

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>x>>y;
	if ((x+y)%3!=0)
		cout<<"0";
	else {
		int t=(x+y)/3,k=min(x,y);
		if (k<t)
			cout<<"0";
		else {
			cout<<C(k-t,t);
		}
	}
	return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;

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

	l--;

	int sum=0;
	bool zero=false;
	for (int i = 1; i <= n; ++i){
		sum+=l+i;
		if(l+i==0)zero=true;
	}

	if(zero){
		cout<<sum<<endl;
		return 0;
	}

	int ab=1e+9,ans=0;
	for (int i = 1; i <= n; ++i){
		if(ab>abs(sum-(sum-(l+i)))){
			ans=sum-(l+i);
			ab=abs(sum-(sum-(l+i)));
		}
	}

	cout<<ans<<endl;
	


	return 0;
}


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

int main() {
  int N,M;
cin>>N>>M;
 vector<vector<int>> LR(M, vector<int>(2));
 for(int j=0;j<M;j++) {
   for(int k=0;k<2;k++){
   cin>>LR.at(j).at(k);
   }
 }
  int s=0,
      S=N;
for(int i=0;i<M;i++){
 s=max(s,LR.at(i).at(0));
 S=min(S,LR.at(i).at(1));
}
  if(S-s+1<=0){
   cout<<0<<endl; 
  }
  else {
   cout<<S-s+1<<endl; 
  }
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 998244353;

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    ll n, s;
    cin >> n >> s;
    ll a[n];
    for (i = 0; i < n; i++) cin >> a[i];

    ll ans = 0;
    VI v(3030, 0);
    for (i = 0; i < n; i++) {
        v[0]++;
        for (j = 3029; j >= a[i]; j--) {
            v[j] += v[j - a[i]];
            v[j] %= mod;
        }
        ans += v[s];
        ans %= mod;
    }
    cout << ans << endl;
}

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

int main()
{
	string s;
	cin >> s;
	bool ok = 1;
	for (int i = 1; i < s.size(); ++i)
	{
		ok *= (s[i] == '9');
	}
	if (ok)
	{
		cout << 9 * (s.size() - 1) + (max(0,(int)(s[0] - '0'))) << endl;
	}
	else
	{
		cout << 9 * (s.size() - 1) + (max(0,(int)(s[0] - '0')-1)) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
(defun solve(l)
  (loop for l1 on l with x
        do (setf x (car l1))
        sum (loop for l2 on (cdr l1) with y
                  do (setf y (car l2))
                  sum (loop for l3 on (cdr l2) with z
                            do (setf z (car l3))
                            count (and (/= x y z)
                                       (< (* 2 (max x y z))
                                          (+ x y z)))))))

(princ (solve (loop repeat (read) collect (read))))

Measured memory_bytes: 24528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
signed main(){
    int n; cin >> n;
    vector<int> v(n);
    for(auto && e: v) cin >> e;
    int maxi = 0;
    for(int i = 1; i<=100;i++){
        int num = 0;
        for(int j = 0;j<v.size();j++){
            if(v[j] >= i)num++;
        }
        if(num >= i)maxi = max(maxi,i);
       // cout << maxi << endl;
    }
    cout << maxi << endl;
}


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

struct team{int id;int data;};

int main(){
	int n;
	while(cin >> n){
		if(n==0){
			break;
		}
		int *data=new int[n];
		team *t=new team[n];
		for(int i=0;i<n;i++){
			data[i]= 0;
			cin >> t[i].id;
			for(int j=0;j<4;j++){
				int m,s;
				cin >> m >> s;
				data[i] += (m*60+s);
			}
			t[i].data=data[i];
		}
		sort(data,data+n);
		int i=0;
		while(t[i].data!=data[0]){
			i++;
		}
		cout<<t[i].id<<endl;
		i=0;
		while(t[i].data!=data[1]){
			i++;
		}
		cout<<t[i].id<<endl;
		i=0;
		while(t[i].data!=data[n-2]){
			i++;
		}
		cout<<t[i].id<<endl;
		delete[] data;
		delete[] t;
	}
	return 0;
}


Measured memory_bytes: 1268
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (auto &e: a) cin >> e;

    vector<bool> t(n, false);
    int pre = 1;
    for (int i = 1; i < n; ++i) {
        if (a[i] > a[i-1]) ++pre;
        else pre = 1;

        t[i] = pre >= k;
    }

    set<int> s;
    for (int i = 0; i < k; ++i) {
        s.insert(a[i]);
    }

    int ans = find(t.begin(), t.end(), true) != t.end() ? 1 : 0;
    if (!t[k-1]) ++ans;

    for (int i = k; i < n; ++i) {
        int mn = *s.begin();
        s.erase(a[i-k]);
        s.insert(a[i]);

        if (t[i]) continue;
        if (mn == a[i-k] && *s.rbegin() == a[i]) continue;
        ++ans;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10368
// ------------------------------------
// Date:2018/ 3/19
// Problem:- Move and A.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << "\n";
#define OK(ok) cout << (ok ? "Yes" : "No") <<　"\n";
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

static const int MOD = 1e9 + 7;
static const int MAX_N = 1;

int main()
{
  string ans = "";
  CIN(N, A, B);
  REP(i, 575) {
    if (not(i & 1)) {
      // Alice
      if (A > B) {
	if (A - 1 == B or A - 1 < 1) ans = "Borys";
	else A--;
      } else {
	if (A + 1 == B or A + 1 > N) ans = "Borys";
	else A++;
      }
    } else {
      // Borys
      if (B > A) {
	if (B - 1 == A or B - 1 < 1) ans = "Alice";
	else B--;
      } else {
	if (B + 1 == A or B + 1 > N) ans = "Alice";
	else B++;
      }
    }
    if (ans != "") break;
  }

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



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

int main()
{
    int n,d,x,y,res=0,r;
    scanf("%d %d %d",&n,&d,&x);
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&y);
        if(d%y)
            res+=(d/y)+1;
        else
            res+=(d/y);
    }
    printf("%d\n",res+x);
}


Measured memory_bytes: 256
defmodule Main do
  def main do
    IO.stream(:stdio, :line)
    |> Enum.map(&String.trim/1)
    |> Enum.map(&String.to_integer/1)
    |> process()
    |> IO.inspect()
  end
  
  defp process([a, b, h]), do: div((a + b) * h, 2)
end

Measured memory_bytes: 30972
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(),
                M = in.nextInt(),
                Q = in.nextInt();

        // memo
        int[][] train = new int[N + 1][N + 1];

        // input
        while (M-- > 0) ++train[in.nextInt()][in.nextInt()];

        // prefix sum
        int[][] psum = new int[N + 1][N + 1];

        // horizontal sum
        for (int l = 1; l <= N; ++l)
            for (int r = 1; r <= N; ++r)
                psum[l][r] = psum[l][r - 1] + train[l][r];

        // 2D sum
        for (int l = 1; l <= N; ++l)
            for (int r = 1; r <= N; ++r)
                psum[l][r] += psum[l - 1][r];

        // answering queries
        while (Q-- > 0) {
            int l = in.nextInt() - 1,
                    r = in.nextInt();
            System.out.println(
                    psum[r][r] + psum[l][l] - psum[l][r] - psum[r][l]
            );
        }

    }
}

Measured memory_bytes: 155856
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x[10000]={},n;
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>a>>b>>c;
    if(a>=c && b>=c){
      x[i]=x[i]+c;
      a=a-c;
      b=b-c;
    }else{
      if(a<b){
	x[i]=x[i]+a;
	a=a-a;
	b=b-a;
      }else{
	x[i]=x[i]+b;
	a=a-b;
	b=b-b;
      }
    }if(a/2>=b){
      x[i]=x[i]+b;
      a=a-2*b;
    }else{
      x[i]=x[i]+a/2;
      a=a%2;
    }if(a/3>=1){
      x[i]=x[i]+a/3;
    }
    cout<<x[i]<<'\n';
  }
  return(0);
}



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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        if((a * b) % 2 == 0){
            System.out.println("Even");
        }else{
            System.out.println("Odd");
        }

        sc.close();
    }
}

Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    int N;

    cin >> N;

    int max = 1;

    while(max*max <= N){
        max += 1;
    }

    cout << (max-1)*(max-1) << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
a = list(map(int,input().split()))
b = []
c = []
for i in range(len(a)):
	b.append(a[i]+1)
for i in range(len(a)):
	c.append(a[i]-1)
a += b + c
counter = Counter(a)
#print(counter.most_common()[0][0])
print(a.count(counter.most_common()[0][0]))

Measured memory_bytes: 32188
module mod_que
    type queue
        integer,pointer:: v(:)
        integer(4):: lst=0, fst=0
    end type
contains
    subroutine que_init(q)
        type(queue):: q

        allocate(q%v(1))
    end subroutine

    subroutine que(q,num)
        type(queue):: q
        integer(4):: num

        q%lst=q%lst+1
        if (q%lst > size(q%v)) call add(q)
        q%v(q%lst) = num
    end subroutine

    subroutine add(q)
        type(queue):: q
        integer(4),pointer:: tmp(:)
        integer(4):: l

        l = size(q%v)
        allocate(tmp(l))
        tmp(1:l) = q%v(1:l)
        deallocate(q%v)
        allocate(q%v(2*l))
        q%v(1:l) = tmp(1:l)
        deallocate(tmp)
    end subroutine

    function deque(q) result(ret)
        type(queue):: q
        integer(4):: ret
        q%fst=q%fst+1
        ret = q%v(q%fst)
    end function
end module mod_que

program name
    use mod_que
    implicit none
    integer(4):: h,w,i,j,nx,ny,cnt
    character(1),allocatable:: a(:,:)
    character(:),allocatable:: aa
    integer(4),allocatable:: cn(:,:)
    logical,allocatable:: see(:,:)
    logical:: all_see
    type(queue):: x,y

    call que_init(x)
    call que_init(y)
    read*, h,w
    allocate(a(0:w+1,0:h+1), cn(0:w+1,0:h+1), see(0:w+1,0:h+1))
    allocate(character(w):: aa)

    cn(:,:) = -2
    see(:,:) = .false.

    do i=1,h
        read*, aa(:)
        do j=1,w
            a(j,i) = aa(j:j)
            if (a(j,i) == '#') then
                cn(j,i) = 0
                see(j,i) = .true.
                call que(x,j)
                call que(y,i)
            else
                cn(j,i) = -1
            end if
        end do
    end do

    cnt=0
    do while(x%lst-x%fst > 0)
        cnt=cnt+1
        nx = deque(x)
        ny = deque(y)
        call next(nx+1,ny, nx,ny)
        call next(nx-1,ny, nx,ny)
        call next(nx,ny-1, nx,ny)
        call next(nx,ny+1, nx,ny)
        all_see = .true.
    end do

    print*, maxval(cn)
contains
    subroutine next(ix,iy, ox,oy)
        integer(4):: ix,iy,ox,oy
        if (cn(ix,iy) /= -1) return
        call que(x,ix)
        call que(y,iy)
        cn(ix,iy) = cn(ox,oy)+1
        see(ix,iy) = .true.
    end subroutine
end program name

Measured memory_bytes: 19148
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <sstream>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int n,m;
    cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    vector<int> c(m);
    rep(i,m)
    {
        cin >> a[i] >> b[i];
        c[i] = 0;
        rep(j,b[i])
        {
            int cj;
            cin >> cj;
            c[i] |= (1<<(cj-1));
        }
    }

    int max_bit=pow(2,n)-1;
    int dp[n+1][max_bit+1];
    const int INF = 1<<29;
    rep(i,n+1) rep(j,max_bit+1) dp[i][j] = INF;
    dp[0][0] = 0;

    rep(i,n)
        rep(j,max_bit+1)
        {
            if(dp[i][j]==INF) continue;
            
            dp[i+1][j] = min(dp[i][j], dp[i+1][j]);
            rep(k,m)
            {
                int tmp_bit = (j|c[k]);
                dp[i+1][tmp_bit] = min(dp[i+1][tmp_bit], min(dp[i][tmp_bit], dp[i][j]+a[k]));
            }
        }
            

    if(dp[n][max_bit] == (1<<29))
        cout << -1 << endl;
    else
        cout << dp[n][max_bit] << endl;
    return 0;
}

Measured memory_bytes: 512
a=[]
for i in range(3):
  a.append(list(map(int,input().split())))
if ((a[1][0]-a[0][0]==a[1][1]-a[0][1]==a[1][2]-a[0][2]) and
    (a[2][0]-a[0][0]==a[2][1]-a[0][1]==a[2][2]-a[0][2])):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int vs[100100][3];
int dp[100100][3];

int* rec(int n) {
    if (0 < dp[n][0] || 0 < dp[n][1] || 0 < dp[n][2]) return dp[n];
    if (n == 1) return vs[n];
    int* pre = rec(n - 1);
    int* vi = vs[n];
    for (int i = 0; i < 3; ++i) {
        int v = vi[i];
        dp[n][i] = max(v + pre[(i + 1) % 3], v + pre[(i + 2) % 3]);
    }
    return dp[n];
}

void solve() {
    int N;
    cin >> N;
    for (int i = 1; i <= N; ++i) cin >> vs[i][0] >> vs[i][1] >> vs[i][2];
    for (int i = 0; i < N; ++i) {
        dp[i][0] = 0;
        dp[i][1] = 0;
        dp[i][2] = 0;
    }
    int* c = rec(N);
    int M = c[0];
    for (int i = 1; i < 3; ++i) {
        M = max(M, c[i]);
    }
    cout << M << endl;
}

int main() {
    solve();
    return 0;
}


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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

const int maxn = 1e5+5;
LL A[maxn];
int C[64];
LL suffix[64];
int N;
LL ans;

void check(LL kk){
    LL temp = 0;
    _for(i,0,N){
        temp += A[i] ^ kk;
    }

    ans = max(ans,temp);
}

int main()
{
    LL K;
    ans = 0;
    cin >> N >> K;
    _for(i,0,N){
        cin >> A[i];
    }
    K++;

    int k_digit = 0;
    _for(i,0,55){
        LL one = 1;
        LL t = one<<i;
        if(t & K){
            k_digit = i;
        }
    }

    check(K-1);

    _for(i,0,k_digit){
        LL one = 1;
        LL t = one<<i;
        _for(j,0,N){
            if(t&A[j]) C[i]++;
            else C[i]--;
        }

        LL pre = i?suffix[i-1]:0;

        if(C[i] < 0){
            suffix[i] = (pre|t);
        }

        else{
            suffix[i] = pre;
        }

        if(!(K & (t<<1))) continue;

        LL suf = suffix[i];
        LL pref = ((K>>(i+2))<<(i+2));

        LL kk = (suf|pref);
        //cout << kk << endl;

        check(kk);

    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024