akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<cmath>


#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
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; }

const long long INF = 1LL<<60;

int lcm(int a,int b){
    //最小公倍数
    return a/__gcd(a,b) * b;
}

// nに５乗で最も近くなるmを返す
ll pow_search(ll n){
    ll m=0;
    while (!(pow(m,5) <= n && n < pow(m+1,5))){
        m++;
    }
    return m;
}

int main()
{
    ll x;
    cin>>x;
    ll match=0;
    ll tmp_a=0;
    for(ll a=0;a<=10000;a++){
        tmp_a=pow(a,5);
        for(ll b=5000;b>=-5000;b--){
            match=tmp_a-pow(b,5);
       
            if(match==x){
                cout<<a<<" "<<b<<endl;
                return 0;
            }
        }
    }

    return 0;

}




Measured memory_bytes: 4168
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        HashMap<Integer, Integer> m = new HashMap<>();
        m.put(s, 1);
        for (int i = 2;; i++) {
            if (s % 2 == 0)
                s = s / 2;
            else
                s = 3 * s + 1;

            if (m.containsKey(s)) {
                System.out.println(i);
                break;
            } else {
                m.put(s, 1);
            }
        }
    }

}


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

int main() {
  int N,i,s=0,a,b;
  cin >> N;
  vector<int> d(N);
  for(i=0;i<N;i++) cin >> d.at(i);
  sort(d.begin(),d.end());
  a=0;
  for(i=0;i<N;i++){
    b = d.at(i);
    if(b==a) continue;
    s++;
    a = b;
  }
  cout << s << endl;
}

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

using namespace std;

struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
	while(u != NIL && k != u->key) {
		if(k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key   = k;
	z->left  = NIL;
	z->right = NIL;
	
	while(x != NIL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	if(y == NIL) {
		root = z;
	} else {
		if( z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
	
int main(void) {
	int n, i, x;
	string com;
	scanf("%d",&n);
	
	for(i=0;i<n;i++) {
		cin >> com;
		if(com[0] == 'f') {
			scanf("%d",&x);
			Node *t = find(root,x);
			if(t != NIL) printf("yes\n");
			else printf("no\n");
		} else if(com == "insert") {
			scanf("%d",&x);
			insert(x);
		} else if(com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}

	return 0;
}


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

int main()
{
    string s;
    int i,j=0,len;
    cin>>s;
    len=s.size();
    for (i=0; i<len; i++)
    {
        if (i%2==0)
        {
            if (s[i]=='L')
            {
                j=1;
                break;
            }
        }
        else
        {
            if (s[i]=='R')
            {
                j=1;
                break;
            }
        }
    }
    if (j==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n,m;
  cin>>n>>m;
  vector<int> L(m);
  vector<int> R(m);
  rep(i, m) {
    cin >> L[i] >> R[i];
  }
  int Lmax = 0,Rmin=INF;
  rep(i,m){
   	Lmax = max(L[i], Lmax);
    Rmin = min(R[i], Rmin);
  }
  if(Rmin >= Lmax)
    cout << (Rmin - Lmax) +1 << endl;
  else
    cout << 0 << endl;
}

Measured memory_bytes: 1024
/*
 * Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$
**/

#include <bits/stdc++.h>
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include <cmath>

using namespace std;

//typedef
typedef string STR;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef priority_queue<int> PQI;
typedef vector<LL> VLL;
typedef vector<ULL> VULL;
typedef vector<STR> VS;
typedef vector<char> VC;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<STR,int> PSI;
typedef pair<int,STR> PIS;
typedef vector<PII> VII;
typedef map<int,int> MII;
typedef map<LL,LL> MLL;
typedef map<STR,int> MSI;
typedef map<char,int> MCI;
typedef map<int,STR> MIS;
typedef set<STR> SS;
typedef set<int> SI;
typedef set<LL> SLL;

//symbolic const
#define MOD 1000000007
#define MAXN 1e9
#define SIZE 10000

//STL keywords
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
#define all(v) v.begin(), v.end()

//functions
#define dec(n) cout<<fixed<<setprecision(n);
#define f(i, n)   for(LL i=0; i<n; i++)
#define fa(i,a,n) for(LL i=a; i<n; i++)

//IO
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test int t;cin>>t;while(t--){solve();}

LL maxLL(LL a, LL b){return (a>b?a:b);}
LL minLL(LL a, LL b){return (a<b?a:b);}

void solve() {
  int n;
  cin>>n;
  LL totw;
  cin>>totw;
  LL dp[totw+1]={0}, w, v;
  for(int i=0; i<n; i++){
      cin>>w>>v;
      for(int j=totw; j>=w; j--){
          dp[j]=maxLL(dp[j], dp[j-w]+v);
      }
  }
  cout<<dp[totw];

}

int main() {
    sync;
    //test;
    solve();
    return 0;
}


Measured memory_bytes: 1152
N = int(input())

a, b = [], []
for n in range(N):
    _a, _b = map(int, input().split(' '))
    a.append(_a)
    b.append(_b)

c, d = [], []
for n in range(N):
    _c, _d = map(int, input().split(' '))
    c.append(_c)
    d.append(_d)

def dfs(v, visited):
    """
    :param v: X側の未マッチングの頂点の1つ
    :param visited: 空のsetを渡す（外部からの呼び出し時）
    :return: 増大路が見つかればTrue
    """
    for u in edges[v]:
        if u in visited:
            continue
        visited.add(u)
        if matched[u] == -1 or dfs(matched[u], visited):
            matched[u] = v
            return True
    return False

# 標準入力からのグラフ読み取り
edges = [set() for _ in range(N)]
matched = [-1] * N

# 隣接行列
M = [[0 for _ in range(N)] for _ in range(N)]
for i in range(N):
    for j in range(N):
        if a[i] < c[j] and b[i] < d[j]:
            edges[i].add(j)

# 増大路発見に成功したらTrue(=1)。合計することでマッチング数となる
print(sum(dfs(s, set()) for s in range(N)))

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ll dp[41][1 << 17] = {};
int n, x, y, z;
bool chk(ll t) {
	if (!(t&(1 << (x - 1))))return true;
	if (!(t&(1 << (x + y - 1))))return true;
	if (!(t&(1 << (x + y + z - 1))))return true;
	return false;
}
int main() {
	cin >> n >> x >> y >> z; dp[0][0] = 1;
	int m = x + y + z;
	rep(i, n) {
		rep(j, (1 << m)) {
			rep(k, 10) {
				ll nex = j << (k + 1); nex += (1 << k); nex %= (1 << m);
				if (chk(nex)) {
					(dp[i + 1][nex] += dp[i][j]) %= mod;
				}
			}
		}
	}
	ll sum = 0;
	rep(j, (1 << m)) {
		sum += dp[n][j];
		sum %= mod;
	}
	ll all = 1;
	rep(i, n) {
		(all *= 10) %= mod;
	}
	cout << ((all - sum) % mod + mod) % mod << endl;
	return 0;
}

Measured memory_bytes: 41344
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long ll;
#define print(x) cout<<(x)<<endl


#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


// DONT USE "int", USE "ll" !!!!!!!!!!!!
int main() {
	int a, b, c, d; cin >> a >> b >> c >> d;
	int out = max(0, min(b,d) - max(a,c));
	print(out);



	



	return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    set<int> b;
    int x = 0;
    REP(i, n) {
        cin >> a[i];
        x ^= a[i];
        b.emplace(a[i] ^ (a[i] - 1));
    }

    int ans = 0;
    for (int i = 29; i >= 0; i--) {
        if ((x & (1 << i)) != 0) {
            bool ok = false;
            for (int y : b) {
                if (y == ((1 << (i + 1)) - 1)) {
                    ok = true;
                    ans++;
                    x ^= y;
                }
            }
            if (!ok) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    if (x == 0) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
int main(){
	int H,W,i,j;

	while(1){
		std::cin >> H >> W;
		if(H==0 && W==0)break;
		for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				if(i==0 || i==H-1 || j==0 ||j==W-1)
				std::cout<<"#";
				else{
					std::cout<<".";
				}
				if(j==W-1)
				std::cout<<"\n";					
				}
			if(i==H-1)
			std::cout<<"\n";	
			}
		
		}
	return 0;
}

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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(12);
    }
} fast;

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

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) (x).erase(unique(all(x)), (x).end())
#define int long long

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

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    string a, b, c;
    char turn = 'a';
    cin >> a >> b >> c;
    reverse(all(a));
    reverse(all(b));
    reverse(all(c));
    while (1)
    {
        if (turn == 'a')
        {
            if (a.empty())
            {
                cout << 'A' << endl;
                break;
            }
            turn = a.back();
            a.pop_back();
        }
        else if (turn == 'b')
        {
            if (b.empty())
            {
                cout << 'B' << endl;
                break;
            }
            turn = b.back();
            b.pop_back();
        }
        else
        {
            if (c.empty())
            {
                cout << 'C' << endl;
                break;
            }
            turn = c.back();
            c.pop_back();
        }
    }
    return 0;
}

Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)

cnt = 0
for i in range(n):
    if a[i] <= x:
        cnt += 1
    x -= a[i]

if x > 0:
    cnt -= 1

print(max(0, cnt))

Measured memory_bytes: 3060
#include<iostream>
#include<bitset>
#include<map>
#include<vector>

using namespace std;

int main(){
    int N,ans=0;
    cin >> N;
    vector<map<int, bool>> syouzikimmono(N);
    for (size_t i = 0; i < N; i++)
    {
        int x;
        cin >> x;
        for (size_t k = 0; k < x; k++)
        {
            int h;
            bool l;
            cin >> h >> l;
            syouzikimmono[i][h-1]=l;
        }
        
    }

    for (int i = (1<<N)-1; i >0; --i)
    {
        bool ok = true;
        for (int k = 0; k < N;++k)
        {
            for (auto &mmm : syouzikimmono[k])
            {
                ;
                if ((bool)(1 << k & i) & mmm.second != (bool)(1 << mmm.first & i))
                {
                    ok = false;
                    break;
                }
            }
            if (!ok)
            {
                break;
            }
            
            
        }

        if (ok)
        {
            if (ans <= __builtin_popcount(i)){
                ans = __builtin_popcount(i);
            }
        }
        
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    //(x+y+z)^2 - (xy+yz+zx) == n
    rep(i,1,n+1){

        int ans=0;
        int sq=sqrt(i);
        rep(a,1,sq+1)rep(b,1,a+1)rep(c,1,b+1){
            if((pow(a+b+c,2) - (a*b+b*c+c*a) )== i){
                if(a == b && b == c)ans++;
                else if(a == b || b == c || c == a)ans += 3;
                else ans += 6;
            }
        }
        cout<<ans<<endl;

    }

    return 0;
}


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

int main()
{
  
  int n,k,q,temp;
  cin>>n>>k>>q;
  unordered_map<int,int> mp;
  for(int i=0;i<q;i++)
  {
    cin>>temp;
    mp[temp]++;
  }
 
  for(int i=1;i<=n;i++)
  {
    if(k-q+mp[i] > 0)
    {
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
  
  
}

Measured memory_bytes: 4772
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

ll ans = INF;


void solv(ll H, ll W){

    for(ll i = 1; i < W; i++){
        //縦横横
        ll a = i * H;
        ll b = H/2*(W-i);
        ll c = H * W - a - b;
        ans = min(ans, abs(max(max(a, b), c)-min(min(a, b), c)));
        //縦縦縦
        ll d = (W-i)/2 * H;
        ll e = H * W - a - d;
        ans = min(ans, abs(max(max(a, d), e)-min(min(a, d), e)));
    }
}

int main() {

    ll H, W;
    cin >> H >> W;

    if(H % 3 == 0 || W % 3 == 0){
        cout << 0 << endl;
        return 0;
    }

    solv(H, W);
    swap(H, W);
    solv(H, W);

    cout << ans << endl;

}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

typedef tuple<P, int> T;
int h,w,k;char a[1000][1000];
vector<P> vec;
map<P, bool> visited;
signed main() {
  cin>>h>>w>>k;
  P s;
  rep(i,h+2)rep(j,w+2)a[i][j] = '#';
  repd(i,1,h+1)repd(j,1,w+1){
    cin>>a[i][j];
    if(a[i][j] == 'S')s = P(i,j);
  }
  queue<T> bfs;bfs.push(T(s,0));
  while(!bfs.empty()){
    T t = bfs.front();bfs.pop();
    P p = get<0>(t);int d = get<1>(t);
    if(visited.count(p) || a[p.first][p.second] == '#' || d > k)continue;
    vec.push_back(p);
    visited[p] = true;
    bfs.push(T(P(p.first-1, p.second), d+1));
    bfs.push(T(P(p.first+1, p.second), d+1));
    bfs.push(T(P(p.first, p.second-1), d+1));
    bfs.push(T(P(p.first, p.second+1), d+1));
  }
  int ans = INF;
  for(auto x : vec){
    chmin(ans, (min({x.first-1, x.second-1, h-x.first, w-x.second})+k-1)/k+1);
  }
  cout << ans << endl;
}



Measured memory_bytes: 51428
#include <cstdio>
#include <cstring>
#include <cstdio>
#include <cmath>
#define N 100010
using namespace std;
struct node{int y,nex;} a[2*N];
int fir[N],len,n,m,A[N],num,now;
bool b[N];

void ins(int x,int y){
  a[++len].y=y;a[len].nex=fir[x];fir[x]=len;
}

void dfs(int x){
  if(now) A[++num]=x;
  for (int k = fir[x]; k; k=a[k].nex) {
    int y=a[k].y;
    if(b[y]) continue;
    b[y]=1;dfs(y);
    break;
  }
  if(now==0) A[++num]=x;
}

int main(int argc, char *argv[])
{
  scanf("%d %d",&n,&m);
  int sx,sy;
  for (int i = 1; i <= m; i++) {
    int x,y;
    scanf("%d %d",&x,&y);
    ins(x,y);ins(y,x);
    sx=x;sy=y;
  }
  b[sx]=b[sy]=1;
  now=0;
  dfs(sx);
  now=1;
  dfs(sy);
  printf("%d\n",num);
  for(int i=1; i <=num; i++) printf("%d ",A[i]);
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
int main(){
  int N;
  cin>>N;
  vector<int> S(N),T;
  T.push_back(101);
  int sum=0;
  rep(i,N){
    cin>>S[i];
    sum+=S[i];
    if(S[i]%10) T.push_back(S[i]);
  }
  int ans;
  if(sum%10) ans=sum;
  else{
    sort(all(T));
    if(T[0]!=101) ans=sum-T[0];
    else ans=0;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
N,S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0]*(S+1) for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    dp[i+1][0] = pow(2,i+1,mod)
    for j in range(1,S+1):
        dp[i+1][j] += 2*dp[i][j]
        if j>=A[i]:
            dp[i+1][j] += dp[i][j-A[i]]
        dp[i+1][j] %= mod
ans = dp[-1][S]
print(ans)

Measured memory_bytes: 132668
#include <iostream>
#include <fstream>
using namespace std;
int n,i;
string s;
int main()
{
    //freopen("data.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin>>s;
    for(i=0;i<s.size();i++)
        if(s[i]=='o')
         n++;
    if(15-s.size()+n>=8) cout<<"YES";
    else cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
main = do
  a <- readLn :: IO Int
  b <- readLn :: IO Int
  c <- readLn :: IO Int
  x <- readLn :: IO Int
  let s = [(i, j, k) | i <- [0..a], j <- [0..b], k <- [0..c]]
  print $ sum $ map (solve x) s

solve :: Int -> (Int, Int, Int) -> Int
solve x (a, b, c) = if a*500 + b*100 + c*50 == x
                      then 1
                      else 0


Measured memory_bytes: 508
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)

# from collections import defaultdict
# d = defaultdict(list)

# from itertools import combinations
# comb = combinations(range(N), 2)

# 累積和
# from itertools import accumulate
# _list = list(accumulate(a_list)

# from functools import lru_cache
# @lru_cache(maxsize=None)
# def setUp(self):
#     dp.cache_clear()


# factのstartを指定しとけば, 計算量O(k)になる
def comb(n, k, mod):
    a = factmod(n, n - k + 1, mod)
    b = factmod(k, 1, mod)

    div = pow(b % mod, mod - 2, mod)  # フェルマーの小定理

    return a * div % mod


def factmod(n, start, mod):
    val = 1
    for i in range(start, n + 1):
        val *= i
        val %= mod
    return val


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    N, K = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int

    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))
    mod = 10**9 + 7

    for i in range(1, K + 1):
        print(comb(N - K + 1, i, mod) * comb(K - 1, i - 1, mod) % mod)


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


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

    def test_入力例_1(self):
        input = """5 3"""
        output = """3
6
1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2000 3"""
        output = """1998
3990006
327341989"""
        self.assertIO(input, output)


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

int main() {
  string s;
  cin >> s;
  int n = s.size()+1;
  vector<int> vec(n,0);
  for(int i = 0; i <= n-2; i++) {
    if(s.at(i) == '<') {
      vec.at(i+1) = max(vec.at(i+1), vec.at(i)+1);
    }
  }
  for(int i = n-2; i >= 0; i--) {
    if(s.at(i) == '>') {
      vec.at(i) = max(vec.at(i), vec.at(i+1)+1);
    }
  }
  ll ans = 0;
  for(int i = 0; i < n; i++) ans += vec.at(i);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2820
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>


#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

using namespace std;

int main()
{
  int ma,da,mb,db;
  cin >>ma>>da>>mb>>db;
  if(ma==mb)
  {
    cout <<0;
  }
  else
  {
    cout <<1;
  }

	return 0;
}





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

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

  string a,b,c;
  a=S.at(0);
  b=S.at(1);
  c=S.at(2);

  if (a==b && b==c){
    cout << "No" <<endl;
  }
  else{
    cout << "Yes" <<endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    vi v;
    rep(i,n){
        if(s[i]==t[i]){
            v.push_back(1);
        }else{
            v.push_back(0);
            i++;
        }
    }
    lint ans;
    if (v[0] == 1)
    {
        ans = 3;
    }else{
        ans = 6;
    }
    rep(i,v.size()-1){
        if(v[i]==0 && v[i+1]==0){
            ans *= 3;
            ans %= MOD;
        }
        else if (v[i] == 0 && v[i + 1] == 1)
        {
            ans *= 1;
            ans %= MOD;
        }else if(v[i]==1 && v[i+1]==0){
            ans *= 2;
            ans %= MOD;
        }else{
            ans *= 2;
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int N, M;
vector<int> G[100000];
vector<int> v;

int cnt[100005];
bool used[100005];

void clear(){
    for(int i = 0; i < N; i++) used[i] = false;
}

void dfs(int v){
    used[v] = true;
    if(G[v].size() == 4) return;
    for(int to : G[v]){
        if(!used[to]) dfs(to);
    }
}

int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(int i = 0; i < N; i++) {
        if(G[i].size()%2 == 1){
            cout << "No" << endl;
            return 0;
        }
        if(G[i].size() == 4) v.push_back(i);
        cnt[G[i].size()]++;
    }
    if(cnt[2] == N){
        cout << "No" << endl;
    }else if(cnt[4] == 1 && cnt[2] == N-1){
        cout << "No" << endl;
    }else if(cnt[4] == 2 && cnt[2] == N-2){
        int a = v[0];
        for(int s : G[a]){
            used[a] = true;
            dfs(s);
            if(!used[v[1]]) {
                cout << "Yes" << endl;
                return 0;
            }
            clear();
        }
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

int main(){
  int N,D;
  cin >> N >> D;
  
  int b,c;
  
  b=N/(2*D+1);
  c=N%(2*D+1);
  
  if(c==0){
    cout << b <<endl;
  }
  else{
    cout << b+1 << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		// map
		
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		String result = "dangerous";
		
		if (b<=a){
			result = "delicious";
		}
		else if (b<=(a+x)){
			result = "safe";
		}
		
		System.out.print(result);
		
		return;
	}
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

int fac(int n) {
    int sum = 1;
    rep(i, 1, n + 1) {
        sum *= i;
    }
    return sum;
}


int main()
{
    int N;
    cin >> N;
    vector<int> P(N), Q(N);

    rep(i, 0, N) cin >> P[i];
    rep(i, 0, N) cin >> Q[i];

    int a = 0, b = 0;

    rep(i, 0, N) {
        if (P.at(i) != 1) {
            a += (P.at(i) - 1) * fac(N - i - 1);
        }
        if (Q.at(i) != 1) {
            b += (Q.at(i) - 1) * fac(N - i - 1);
        }
        
        for (int j = i + 1; j < N; j++) {
            if (P.at(i) < P.at(j)) {
                P.at(j)--;
            }
            if (Q.at(i) < Q.at(j)) {
                Q.at(j)--;
            }
        }
    }

    cout << abs(a - b) << endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np

s = np.array(input().split()).astype(int)
# =============================================================================
# if s.find("A") >= 0 and s.find("B") >= 0:
#     print("Yes")
# else:
#     print("No")
# =============================================================================

# =============================================================================
# N,A,B = s
# 
# print(N//(A+B)*A + np.array([N%(A+B),A]).min())
# =============================================================================

A,B = s

eight =  100/8
ten = 100/10
x1 = A*eight
x2 = A*ten
ans = []

for i in np.arange(0,np.array([x1,x2]).max().astype(int) + 100):
    if int(i * 1/eight) == A and int(i * 1/ten) == B:
        ans.append(i)
if len(ans) == 0:
    print(-1)
else:
    print(np.array(ans).min().astype(int))


Measured memory_bytes: 12508
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, 60) {
        ll x = 0;
        rep(j, n) if (a[j]>>i&1) ++x;
        ll now = x * (n - x) % mod;
        rep(j, i) now = now * 2LL % mod;
        ans += now;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5512
#include <iostream>

using namespace std;

int bubbleSort(int *a, int size) {
    bool flag = true;
    int count = 0;
    for (int i = 0; flag; i++) {
        flag = false;
        for (int j = size - 1; j >= i + 1; j--) {
            if (a[j - 1] > a[j]) {
                count++;
                flag = true;
                swap(a[j], a[j - 1]);
            }
        }
    }
    return count;
}

int main() {
    int n;
    cin >> n;
    int a[100];
    for (int i = 0; i < n; i++) cin >> a[i];
    int c;
    c = bubbleSort(a, n);
    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << a[i];
    }
    cout << endl;
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3068
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	x := getInt()
	if x == 3 || x == 5 || x == 7 {
		out("YES")
		return
	}
	out("NO")
}


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

int main(){
    int c = getchar_unlocked();;
    long a(0), b(0);
    while(c >= 40){
        ++(c & 1 ? a : b);
        c = getchar_unlocked();
    }
    cout << 2 * min(a, b) << endl;
    return 0;
}

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

int main() {
	int t, x;
	cin >> t >> x;
	double ans = double(t) / x;
	cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define EPS (1e-7)
#define INF (1e11)
#define PI (acos(-1))

typedef long long unsigned int ull;
typedef long long int ll;
typedef pair<ll, ll> P;

ll T, N, A, B, C, D;

map<ll,ll> cost;
map<ll,bool> seen;

ll dfs(ll num){
    if(seen[num]) return cost[num];
    seen[num] = true;
    cost[num] = INF;

    int by[3] = {2,3,5};
    ll ABC[3] = {A,B,C};
    ll dD[6];
    ll next[6];
    REP(i,3)
    {
        next[2 * i] = num / by[i];
        next[2 * i + 1] = num / by[i] + 1;
        dD[2 * i] = (num - by[i] * next[2 * i]) * D;
        dD[2 * i + 1] = (next[2 * i + 1] * by[i] - num) * D;
    }
    REP(i,6)
    {
        if((ABC[i/2] + dD[i])/D < num-next[i]){
            cost[num] = min(cost[num], dfs(next[i]) + ABC[i / 2] + dD[i]);
        }else{
            cost[num] = min(cost[num], dfs(next[i]) + (num-next[i]) * D);
        }
    }
    //cout << "dfs(" << num << ")=" << cost[num] <<endl;
    return cost[num];
}
int main()
{
    cin >> T;
    ll n[T],a[T],b[T],c[T],d[T];
    REP(t,T){
        cin >> n[t] >> a[t] >> b[t] >> c[t] >> d[t];
    }
    REP(t,T){
        N = n[t];
        A = a[t];
        B = b[t];
        C = c[t];
        D = d[t];
        cost.clear();
        seen.clear();
        cost[0] = 0;
        seen[0] = true;
        cost[1] = D;
        seen[1] = true;
        cout << dfs(N) << endl;
    }
}

Measured memory_bytes: 5924
def main(str)
  n, as = str.split("\n")
  n = n.to_i
  as = as.split(" ").map(&:to_i)
  ret = n.times.map { 0 }
  as.each { |i| ret[i - 1] += 1 }
  puts ret.map(&:to_s).join("\n")
end

unless ENV["TEST"]
  main($stdin.read.chomp)
  exit(0)
end

Measured memory_bytes: 39076
class BinaryIndexTree
  attr_reader :bit, :size

  def initialize(size, init: 0)
    @bit = Array.new(size + 1, init)
    @size = size
  end

  def sum(i)
    s = 0

    while i > 0
      s += bit[i]
      i -= i & -i
    end

    s
  end

  def add(i, x)
    while i <= size
      bit[i] += x
      i += i & -i
    end
  end
end

N, K = gets.split.map(&:to_i)
A = N.times.map { gets.to_i }
RUI = [0]

A.each do |a|
  RUI << RUI.last + a - K
end

bit = BinaryIndexTree.new(N + 1)

S = RUI.sort

order = Hash.new

S.each.with_index(1) do |s, i|
  order[s] = i
end

# p order
ans = 0

(N + 1).times do |i|
  o = order[RUI[i]]
  # p [RUI[i], o]
  ans += i - bit.sum(o)
  bit.add(o, 1)
end

puts (N * (N + 1)) / 2 - ans


Measured memory_bytes: 23316
n = int(input())
s = input()
r, b, g = 0, 0, 0
for c in s:
  if c == 'R':
    r += 1
  elif c == 'G':
    b += 1
  elif c == 'B':
    g += 1
  else:
    raise ValueError
count = r * b * g
for i in range(n-2):
  s_i = s[i]
  for j in range(i+1, n-1):
    k = j + j - i
    if k < n and s_i != s[j] and s_i != s[k] and s[j] != s[k]:
      count -= 1
print(count)

Measured memory_bytes: 9216
// atcoder/abc160/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  lli x;
  while (cin >> x) {
    cout << ((x / 500) * 1000) + (((x % 500) / 5) * 5) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
 
int main() {
  #ifndef ONLINE_JUDGE
 // ioso ffe
  #endif
  ll a[6]; //cin >> a >> b >> c >> d >> e;
  ll ans=0;
  for(int i=1;i<=5;i++) {
    cin >> a[i];
    if(a[i]==0) {
      ans = i;
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;


int check(ll N, ll K, ll X, ll* A){
    ll B[500]={};


    
    ll temp_sum = 0;
    for(int i=0; i<N; i++){
        temp_sum += A[i]%X;
        B[i] = A[i]%X;
    }
    
    if(temp_sum%X != 0){
        return 0;
    }
    
    sort(B,B+N);
    
    
    ll cnt=temp_sum/X;
    for(int i=N-1; i>=N-cnt; i--){
        temp_sum -= B[i];
    }
    
    if(temp_sum<=K){
        return 1;
    }else{
        return 0;
    }
    
}

int main(){
    int N;
    cin >> N;
    ll K;
    cin >> K;
    ll A[500];
    ll sumA=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        sumA+=A[i];
    }
    

    sort(A,A+N);
    
    ll ans = 1;
    for(ll i=1; i*i<=sumA; i++){
        if(check(N,K,i,A)==1){
            ans=max(ans,i);
        }
        if(check(N,K,sumA/i,A)==1){
            ans=max(ans,sumA/i);
        }
    }
    

    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x) << "\n";

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &i : a)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

  VAR(string, s);
  int N = s.size();
  
  if (s[0] == s.back()) N++;

  if (N % 2 == 0) OUT("Second")
  else OUT("First")
  BR;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>//头文件
using namespace std;
int a,b;//长度
string str;
bool tf;//判断开关
int main(){
    cin>>a>>b>>str;
    for(int i=0;i<(a+b+1);i++){//可以替换为str.length()
        if(int(str[i])>='0'&&int(str[i])<='9')continue;//如果符合就什么都不做
        else//否则
            if(i!=a){//先判断是不是第a+1位
                tf=1;//False
                break;//尽早结束
            }
            /*if里面不是a+1是因为我的开头是0*/
    }
    if(str[a]!='-')tf=1;//再判断是不是-
    if(tf==0)cout<<"Yes\n";//如果全部符合
    else cout<<"No\n";//有一个不符合
    /*懒得打endl了*/
    return 0;//结束
}

Measured memory_bytes: 256
a = []
a = gets.split.map(&:to_i)
sq = a[0] * a[1]
#p a
if a[0] % 3 == 0 || a[1] % 3 == 0
  puts 0
  exit
end
if a[0]  == 1 || a[1]  == 1
  puts 1
  exit
end
cnt = sq
for i in 1..a[0]-1
  to = a[1] * i
  le = (a[0] - i)*(a[1]/2)
  ri = sq - to - le
  #p a[0]-i
  #puts "#{to} #{le} #{ri}"
  to2 = a[1]*((a[0]-i)/2)
  to3 = sq - to - to2
  if cnt >=  [to, le, ri].max - [to, le, ri].min
    cnt = [to, le, ri].max - [to, le, ri].min
  end
  if cnt >=  [to, to2, to3].max - [to, to2, to3].min
    cnt = [to, to2, to3].max - [to, to2, to3].min
  end
end
c = a[0]
a[0] = a[1]
a[1] = c
#p a
for i in 1..a[0]-1
  to = a[1] * i
  le = (a[0] - i)*(a[1]/2)
  ri = sq - to - le
  #p a[0]-i
  #puts "#{to} #{le} #{ri}"
  to2 = a[1]*((a[0]-i)/2)
  to3 = sq - to - to2
  if cnt >=  [to, le, ri].max - [to, le, ri].min
    cnt = [to, le, ri].max - [to, le, ri].min
  end
  if cnt >=  [to, to2, to3].max - [to, to2, to3].min
    cnt = [to, to2, to3].max - [to, to2, to3].min
  end
end
puts cnt

Measured memory_bytes: 3836
#include<iostream>
#include<numeric>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<utility>
#include<cmath>
#include<tuple>
#include<string>
#include<bitset>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
typedef long long ll;

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int>> v(n,vector<int>());
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    vector<int> d(n,1e9);
    vector<int> p(n,-1);
    d[0]=0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int x=q.front();
        q.pop();
        for(auto nx: v[x]){
            if(d[nx]!=1e9) continue;
            d[nx]=d[x]+1;
            p[nx]=x;
            q.push(nx);
        }
    }
    
    cout<<"Yes"<<endl;
    for(int i=1;i<n;i++) cout<<p[i]+1<<endl;
}

Measured memory_bytes: 10708
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define per(i, n, s) for (int i = (n-1); i >= (int)(s); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;

int main(){
    int n,k; cin>>n>>k;
    map<int,int> cnt;
    rep(i,0,n){
        int x; cin>>x;
        cnt[x]++;
    }
    vector<int> t;
    for(auto &i: cnt){
        t.push_back(i.second);
    }
    sort(all(t));
    reverse(all(t));
    ll ans=0;
    rep(i,k,t.size()){
        ans+=t[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 10748
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int N = Integer.parseInt(str);
		long pow = 1;
		for (int i = 0; i < N; i++) {
			pow = pow * (i + 1) % 1_000_000_007;
		}
		System.out.println(pow);
	}
}


Measured memory_bytes: 21332
#D
from fractions import gcd
#from math import gcd
import collections
a, b = map(int,input().split())
tmp = gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if tmp == 1:
    l = 1
    ans = 1
else:
    l = prime_factorize(tmp) + [1]
    clist = collections.Counter(l)
    ans = len(clist.keys())
print(ans)



Measured memory_bytes: 5088
package main

import "fmt"

func smaller(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	ans := b + smaller(c, b+a+1)
	fmt.Println(ans)
}


Measured memory_bytes: 512
import sys

input = sys.stdin.readline


def main():
    A, B, C = map(int, input().split())

    if A < B:
        if A < C < B:
            ans = "Yes"
        else:
            ans = "No"
    else:
        if B < C < A:
            ans = "Yes"
        else:
            ans = "No"

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<iostream>/*入出力関連ヘッダファイル*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int N;
int H[105];
int count;

int main(void) {
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> H[i];
  }
  int max=0;
  for(int i=0; i<N; i++){
    if(H[i]>=max){
      max=H[i];
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
    #define pb push_back
    #define sz size()
     
    using namespace std;
    using ll = long long int;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     

const ll ZER = 0;
ll MOD = 998244353;

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> l(k), r(k);
    rep(i, k)cin >> l[i] >> r[i];
    vector<ll> dp(n + 1, 0);
    vector<ll> dpsum(n + 1, 0);
    dp[1] = 1;
    dpsum[1] = 1;
    REP(i, 2, n){
        rep(j, k){
            ll li = max(ZER + 1, i - r[j]), ri = i - l[j];
            if(ri < 0)continue;
            (dp[i] += dpsum[ri] - dpsum[li - 1]) %= MOD;
        }
        (dpsum[i] = dpsum[i - 1] + dp[i]) %= MOD;
    }
  	//rep(i, n + 1)cout << dp[i] << " ";
  	if(dp[n] < 0)dp[n] += MOD;
    cout << dp[n] << endl;
}



Measured memory_bytes: 6048
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <cmath>
using namespace std;


int main(){
    int n;
    cin >> n;
    long long arr[n], e[n], p[n];
    for(int i = 0; i < n; i++)cin >> arr[i];
    e[n-1] = -arr[n-1];
    for(int i = n-2; i >= 0; i--){
        e[i] = e[i+1] + (2 * (i % 2) - 1) * arr[i];
    }
    p[n-1] = arr[n-1];
    for(int i = n-2; i >= 0; i--){
        p[i] = p[i+1] + (2 * ((i + 1) % 2) - 1) * arr[i];
    }
    /*for(int i = 0; i < n; i++)cout << e[i] << ' ';
    cout << '\n';
    for(int i = 0; i < n; i++)cout << p[i] << ' ';
    cout << '\n'; */
    cout << p[0] << ' ';
    for(int i = 1; i < n; i++){
        if(i % 2 == 0){
            cout << p[i] + e[0] - e[i] << ' ';
        } else {
            cout << e[i] + p[0] - p[i] << ' ';
        }
    } 
}


Measured memory_bytes: 3712